Skip to content

Instantly share code, notes, and snippets.

@xakpc
Created September 30, 2020 23:45
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save xakpc/093c85494c623954107ea7cfc8b88dd6 to your computer and use it in GitHub Desktop.
Save xakpc/093c85494c623954107ea7cfc8b88dd6 to your computer and use it in GitHub Desktop.
Card template for Blazor Bootstrap
<div class="card @Class" @attributes="InputAttributes">
@if (Title != null)
{
<div class="card-header">
<h5 class="card-title">@Title</h5>
</div>
}
<div class="card-body">
@ChildContent
</div>
@if (Footer != null)
{
<div class="card-footer text-muted">
@Footer
</div>
}
</div>
@code {
[Parameter]
public string Class { get; set; } = "mb-3";
[Parameter]
public RenderFragment ChildContent { get; set; }
[Parameter]
public RenderFragment Body
{
get => ChildContent;
set => ChildContent = value;
}
[Parameter]
public RenderFragment Footer { get; set; }
[Parameter]
public string Title { get; set; }
[Parameter(CaptureUnmatchedValues = true)]
public Dictionary<string, object> InputAttributes { get; set; } = new Dictionary<string, object>();
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment