Card
in namespace DotVVM.Framework.Controls.Bootstrap4
Renders the Bootstrap panel.
Usage & Scenarios
Renders the Bootstrap card with flexible content options. The card can contain one of more content items:
- CardBody for text content.
- CardImage for image or other media content.
- CardListGroup for lists of items.
Sample 1: Basic Card
The contents of the card are just placed inside the control element.
You can use HeaderText
or HeaderTemplate
, and FooterText
or FooterTemplate
properties to specify contents of the card header and footer bar.
To provide a text content, use CardBody control.
<bs:Card FooterText="Card Footer">
<HeaderTemplate>
<h1>Header</h1>
</HeaderTemplate>
<bs:CardBody Text="Body of the card" />
</bs:Card>
Sample 2: Card with images and lists
The card can contain images or lists. Use any combination of CardBody, CardImage and CardListGroup controls.
<bs:Card FooterText="Card Footer">
<bs:CardImage ImageUrl="~/Content/Images/img11.jpg" ToolTip="Card Image">
<bs:CardBody>
<h1>Overlayed body</h1>
<p>
Another text
</p>
</bs:CardBody>
</bs:CardImage>
<bs:CardListGroup DataSource="{value: Texts}" TextBinding="{value: _this}" />
<bs:CardBody>
<p>Some buttons</p>
<bs:RouteLink RouteName="Card_Advanced" Text="RouteLink" Type="Info" />
<bs:Button Click="{command: DoSomething()}" Text="Button" Type="Danger" />
</bs:CardBody>
</bs:Card>
public class ViewModel : DotvvmViewModelBase
{
public string[] Texts { get; } = new[] { "red", "green", "blue" };
public void DoSomething()
{
}
}
Properties
Name | Type | Description | Notes | Default Value | |
---|---|---|---|---|---|
Attributes | Dictionary<String,Object> |
attribute
static value
|
null | ||
ClientIDMode | ClientIDMode | Gets or sets the client ID generation algorithm. |
attribute
static value
|
Static | |
Content | List<ICardItem> | Gets or sets the contents of the main section of the panel. |
inner element
static value
default
|
null | |
DataContext | Object | Gets or sets a data context for the control and its children. All value and command bindings are evaluated in context of this value. |
attribute
bindable
|
null | |
FooterTemplate | ITemplate | Gets or sets the contents of the footer section of the panel. |
inner element
static value
|
null | |
FooterText | String | Gets or sets footer text |
attribute
static value
bindable
|
null | |
HeaderTemplate | ITemplate | Gets or sets the contents of the header section of the panel. |
inner element
static value
|
null | |
HeaderText | String | Gets or sets header text. |
attribute
static value
bindable
|
null | |
ID | String | Gets or sets the unique control ID. |
attribute
static value
bindable
|
null | |
IncludeInPage | Boolean | Gets or sets whether the control is included in the DOM of the page. |
attribute
bindable
|
True | |
InnerText | String | Gets or sets the inner text of the HTML element. |
attribute
static value
bindable
|
null | |
SubtitleText | String | Gets or sets subtitle of the card. |
attribute
static value
bindable
|
null | |
Text | String | Gets or sets inner text of the card. |
attribute
static value
bindable
|
null | |
TitleText | String | Gets or sets title of the card. |
attribute
static value
bindable
|
null | |
Visible | Boolean | Gets or sets whether the control is visible. |
attribute
bindable
|
True |