UI Toolbox ロゴUI Toolbox
サポート

このページは翻訳です。サポートと動画チュートリアルは主に英語で提供しており、英語版のページが正式な内容です。 英語版

Card

Card は境界線のあるコンテナーです: タイトル、説明、右側のアクションを持つヘッダー、そのあとにコンテンツ、そしてフッター。

Day 3 のバッジ、50 から 500 ゴールドの 7 つの日のタイル (最初の 2 つは塗りつぶし)、Today: 100 gold の行、Claim ボタンを持つ Daily reward カードDay 3 のバッジ、50 から 500 ゴールドの 7 つの日のタイル (最初の 2 つは塗りつぶし)、Today: 100 gold の行、Claim ボタンを持つ Daily reward カード

ヘッダーのアクションとフッターを持つカードの作り方です。

<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" });

タイトルは AnimatedLabel なので、エフェクトタグが使えます。金のグラデーションで輝く伝説のタイトルです。

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

これらの色は、既定の toolbox テーマのような暗いカード用です。明るいカードでは、タイトルが 4.5:1 のコントラストを保つように、より暗い色を使ってください。

メンバー 説明
Title (title) ヘッダーの太字の行。空のタイトルは行を表示しません。<wave> のようなエフェクトタグが使えます。タグのないタイトルは、フレームごとの処理をしません。
Description (description) タイトルの下の控えめなテキスト。リッチテキストのタグが使えます。空の説明は行を表示しません。
Icon (icon) ヘッダーの左にある画像で、タイトルと説明の列の中央に置かれます。--tb-color-text-muted の色合いになります。画像がなければ何も表示せず、場所も取りません。
Action ヘッダーの右側の場所。コードからヘッダーのボタンを追加します。
Footer コンテンツの下の行。コードからフッターのボタンを追加します。

設定ページのような設定の行です。アイコン、太字のタイトル、控えめな説明、右側のセグメント式の選択部分を持ちます。選択部分は、アクションスロットに置いた ToggleButtonGroup です。

<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>

ヒント:

サンプルでの使われ方

スタイル

クラス 要素
tb-card カード: --tb-color-surface の背景、--tb-color-border の境界線、--tb-radius-md の角、--tb-spacing-md のパディング。
tb-card__header テキストとアクションを持つ行。内容がなければ隠れます。
tb-card__icon ヘッダーの左の画像。--tb-size-button の正方形で、色は --tb-color-text-muted。画像がなければ非表示です。
tb-card__headings タイトルと説明を持つ列。
tb-card__title 大きなフォントサイズの太字のタイトル。tb-animated-label クラスのない AnimatedLabel。
tb-card__description --tb-color-text-muted の説明。
tb-card__action-slot ヘッダーの右側の行。
tb-card__content コンテンツの子の親。
tb-card__footer-slot コンテンツの下の行。
tb-card__action 子に付けると、その子をヘッダーに送ります。
tb-card__footer 子に付けると、その子をフッターに送ります。
.tb-card {
    padding: 16px;
    background-color: var(--tb-color-surface-alt);
}
.tb-card__footer-slot { justify-content: flex-end; }

CardDemo シーンは、既定値の毎日の報酬、コードで作る店のアイテムカード、印と目標を持つクエスト、そしてキャラクターカードを示します。