Collapsible.razor 627 B

123456789101112131415161718192021222324252627282930
  1. <div class="second-block__input__file__label__box" @onclick="@Toggle">
  2. <label class="second-block__input__file__label">
  3. <span>@( this.Collapsed ? "+" : "-")</span>
  4. <p>@LabelText</p>
  5. </label>
  6. </div>
  7. @if (!Collapsed)
  8. {
  9. <div style="margin-top: 10px">
  10. @ChildContent
  11. </div>
  12. }
  13. @code {
  14. [Parameter]
  15. public RenderFragment ChildContent { get; set; }
  16. [Parameter]
  17. public bool Collapsed { get; set; } = true;
  18. //input params coming from from page
  19. [Parameter]
  20. public string LabelText { get; set; }
  21. void Toggle()
  22. {
  23. Collapsed = !Collapsed;
  24. }
  25. }