CardBody

in namespace DotVVM.Framework.Controls.Bootstrap4

Usage & Scenarios

Renders a text content inside the Card control.

https://getbootstrap.com/docs/4.3/components/card/

Sample 1: Basic CardBody

Use the TitleText, SubtitleText and Text properties to provide two levels of title and a text content for the card.

<bs:Card>
  <bs:CardBody 
      TitleText="Main title"
      SubtitleText="Secondary title"
      Text="Body of the card" />
</bs:Card>

Sample 2: Templated CardBody

If you need to provide a custom content in the card body, place the content inside the control.

Bootstrap recommends the following CSS classes to be used in the card body templates:

  • h1, ..., h6 elements should have card-title or card-subtitle CSS classes.
  • p and other text elements should have card-text CSS class.
  • a elements should have card-link CSS class.

You can set AddAppropriateCardClassesToContent property to true which makes the control to add the CSS classes automatically based on the rules mentioned above.

<bs:Card FooterText="Card Footer">
  <bs:CardImage ImageUrl="~/Content/Images/img11.jpg" ToolTip="Card Image">
    <bs:CardBody>
        <h1>Overlaid 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: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
property icon AddAppropriateCardClassesToContent Boolean Gets or sets whether appropriate classes (card-text, card-link, ...) should be added to inner elements. Can be used only when Content template is used.
attribute
inner element
static value
bindable
default
False
property icon ContentTemplate ITemplate Gets or sets the contents of the main section of the panel.
attribute
inner element
static value
bindable
default
null
property icon SubtitleText String Gets or sets subtitle of the card.
attribute
inner element
static value
bindable
default
null
property icon Text String Gets or sets inner text of the card.
attribute
inner element
static value
bindable
default
null
property icon TitleText String Gets or sets title of the card.
attribute
inner element
static value
bindable
default
null

HTML produced by the control