UI Toolbox logoUI Toolbox
Support

Card

A Card is a container with a border: a header with a title, a description and an action at the right, then the content, then a footer.

A Daily reward card with a Day 3 badge, seven day tiles from 50 to 500 gold with the first two filled, the line Today: 100 gold and a Claim buttonA Daily reward card with a Day 3 badge, seven day tiles from 50 to 500 gold with the first two filled, the line Today: 100 gold and a Claim button

How to make a card with a header action and a footer:

<tb:Card
    title="Plan"
    description="Your plan renews on the first day of each month.">
    <ui:Button text="Change" class="tb-card__action" />
    <ui:Label text="Pro, 5 seats" />
    <ui:Label text="12 GB of 50 GB used" />
    <ui:Button text="Cancel the plan" class="tb-card__footer" />
    <ui:Button text="Add seats" class="tb-card__footer" />
</tb:Card>
var card = new Card
{
    Title = "Plan",
    Description = "Your plan renews on the first day of each month."
};
card.Add(new Label("Pro, 5 seats"));
card.Action.Add(new Button(changePlan) { text = "Change" });
card.Footer.Add(new Button(addSeats) { text = "Add seats" });

The title is an AnimatedLabel, so the effect tags work in it. A legendary title in a gold gradient that shines:

quest.Title = "<gradient=#ff9f1c,#ffe066><shine>"
    + "The Hollow King</shine></gradient>";

These colors are for a dark card, as in the default toolbox theme. On a light card, use darker colors, so the title keeps a contrast of 4.5:1.

Member Description
Title (title) The bold line of the header. An empty title shows no line. Effect tags such as <wave> work in it; a title with no tag does no work each frame.
Description (description) The muted text under the title. Rich text tags work. An empty description shows no line.
Icon (icon) The picture at the left of the header, centered on the title and the description. It takes the --tb-color-text-muted tint. None shows no picture and takes no room.
Action The place at the right of the header. Add the header buttons to it from code.
Footer The row under the content. Add the footer buttons to it from code.

A settings row, as in a settings page: an icon, a bold title, a muted description and a segmented picker at the right. The picker is a ToggleButtonGroup in the action slot:

<tb:Card
    icon="project://database/Assets/Icons/density.png"
    title="Density"
    description="How much room the lists take.">
    <ui:ToggleButtonGroup class="tb-card__action"
        allow-empty-selection="false">
        <ui:Button text="Comfortable" />
        <ui:Button text="Compact" />
    </ui:ToggleButtonGroup>
</tb:Card>

Tips:

In the examples

Styling

Class Element
tb-card The card: a --tb-color-surface background, a --tb-color-border border, --tb-radius-md corners and --tb-spacing-md padding.
tb-card__header The row with the texts and the action. Hidden when it has no content.
tb-card__icon The picture at the left of the header. A --tb-size-button square, in --tb-color-text-muted. Hidden without an image.
tb-card__headings The column with the title and the description.
tb-card__title The bold title in the large font size, an AnimatedLabel without the tb-animated-label class.
tb-card__description The description in --tb-color-text-muted.
tb-card__action-slot The row at the right of the header.
tb-card__content The parent of the content children.
tb-card__footer-slot The row under the content.
tb-card__action Put it on a child to send the child to the header.
tb-card__footer Put it on a child to send the child to the footer.
.tb-card {
    padding: 16px;
    background-color: var(--tb-color-surface-alt);
}
.tb-card__footer-slot { justify-content: flex-end; }

The CardDemo scene shows a daily reward with the defaults, the item cards of a shop made in code, a quest with a seal and objectives, and a character card.