OverviewInstallationMigrating to 1.0Themes and layersKanok designCustomizingIconsForms and validationFrameworksUsing with AIButtonText inputText areaNumber inputSearchSelectDropdownComboboxMulti-selectCheckboxRadio buttonToggleDate pickerTime pickerSliderFile uploaderModalSide panelTearsheetNotificationToastTooltipDefinition tooltipPopoverToggletipMenuData tableStructured listPaginationContained listTree viewTabsBreadcrumbLinkPagination navContent switcherAccordionProgress indicatorUI shellTagTileCardProduct cardCode snippetCopy buttonUser avatarTruncated textListLoadingInline loadingProgress barSkeletonBadge indicatorStatus indicatorGridHeadingLayerAction setPage headerBig numberEdit in placeIntroductionText inputText areaNumber inputSearchSelectDropdownComboboxMulti-selectCheckboxRadio buttonToggleDate pickerTime pickerSliderFile uploaderTabsPagination navContent switcherTooltipDefinition tooltipPopoverMenuAccordionProgress indicatorUI shellModalSide panelTearsheetNotificationToastData tableStructured listPaginationTree viewCode snippetCopy buttonTruncated textLoadingTagCardProduct cardEdit in place
Card
A card is a box built from parts: media, a header with a title and its actions, a body and a footer. Use it for a set of things the user browses or picks from: projects, reports, documents. It is Carbon's Card (a preview in Carbon): square, no border, no shadow, on the next layer colour.
Office lease, Silom branchThree-year lease from 1 January 2027. Waiting for the landlord's signature.Open contract
HTMLReactReact + Tailwind<ui-cardstyle="max-width: 360px">
<ui-card-mediaratio="16x9">
<imgalt=""src="data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 160 90'%3E%3Crect width='160' height='90' fill='%23d0e2ff'/%3E%3Cpath d='M66 20h22l10 10v40H66z' fill='%23ffffff'/%3E%3Cpath d='M72 42h20M72 50h20M72 58h12' stroke='%230f62fe' stroke-width='2'/%3E%3C/svg%3E" />
</ui-card-media>
<ui-card-header>
<ui-card-titlelabel="Contract"description="Updated 3 October 2026">Office lease, Silom branch</ui-card-title>
</ui-card-header>
<ui-card-body>Three-year lease from 1 January 2027. Waiting for the landlord's signature.</ui-card-body>
<ui-card-footer>
<ui-card-action><ui-buttonkind="ghost">Open contract</ui-button></ui-card-action>
</ui-card-footer>
</ui-card><UiCardstyle={{ maxWidth:360 }}>
<UiCardMediaratio="16x9"><imgalt=""src={leaseImage} /></UiCardMedia>
<UiCardHeader>
<UiCardTitlelabel="Contract"description="Updated 3 October 2026">Office lease, Silom branch</UiCardTitle>
</UiCardHeader>
<UiCardBody>Three-year lease from 1 January 2027. Waiting for the landlord's signature.</UiCardBody>
<UiCardFooter>
<UiCardAction><UiButtonkind="ghost">Open contract</UiButton></UiCardAction>
</UiCardFooter>
</UiCard><CardclassName="max-w-[360px]">
<CardMediaratio="16x9"><imgalt=""src={leaseImage} /></CardMedia>
<CardHeader>
<CardTitlelabel="Contract"description="Updated 3 October 2026">Office lease, Silom branch</CardTitle>
</CardHeader>
<CardBody>Three-year lease from 1 January 2027. Waiting for the landlord's signature.</CardBody>
<CardFooter>
<CardAction><Buttonkind="ghost">Open contract</Button></CardAction>
</CardFooter>
</Card>
Installation
npmshadcn · Web componentshadcn · React + TailwindManualnpminstall@purpurabog/uinpxshadcn@4add@kanok-ui/cardnpxshadcn@4add@kanok-ui/tw-card# Web component# 1. Install the dependenciesnpminstalllit@^3.3.0# 2. Copy each file's "content" from# https://cdn.jsdelivr.net/npm/@purpurabog/ui@2.3.0/registry/card.json# to its target:# components/ui/primitives/card/card-action.ts# components/ui/primitives/card/card-actions.ts# components/ui/primitives/card/card-body.ts# components/ui/primitives/card/card-footer.ts# components/ui/primitives/card/card-header-media.ts# components/ui/primitives/card/card-header.ts# components/ui/primitives/card/card-media.ts# components/ui/primitives/card/card-title-media.ts# components/ui/primitives/card/card-title.ts# components/ui/primitives/card/card.ts# 3. Do the same for the items it needs (registry/<name>.json):# core-overflow, menu, overflow-menu, shared-element, shared-field, shared-localize, shared-navigate, tokens# React + Tailwind# 1. Install the dependenciesnpminstall@purpurabog/ui@^2.3.0# 2. Copy each file's "content" from# https://cdn.jsdelivr.net/npm/@purpurabog/ui@2.3.0/registry/tw-card.json# to its target:# components/ui/react-tw/card.tsx# 3. Do the same for the items it needs (registry/<name>.json):# core-overflow, tw-i18n, tw-icon-button, tw-menu, tw-refs, tw-theme, tw-utils
npm gives you every component from the package. shadcn copies the source into your app instead: a copy pinned to this version that you can change. The shadcn commands need the @kanok-ui registry in your components.json once, see Installation.
Use it
All the parts load from one module. In React, import a wrapper for each element (UiCard, UiCardHeader, UiCardTitle …) from @purpurabog/ui/react.
HTMLReactReact + Tailwind<scripttype="module">import'@purpurabog/ui/card';</script>
<ui-card>
<ui-card-header><ui-card-title>Office lease</ui-card-title></ui-card-header>
<ui-card-body>Waiting for the landlord's signature.</ui-card-body>
</ui-card>import { UiCard, UiCardHeader, UiCardTitle, UiCardBody } from'@purpurabog/ui/react';
<UiCard>
<UiCardHeader><UiCardTitle>Office lease</UiCardTitle></UiCardHeader>
<UiCardBody>Waiting for the landlord's signature.</UiCardBody>
</UiCard>import { Card, CardHeader, CardTitle, CardBody } from'@/components/ui/react-tw/card';
<Card>
<CardHeader><CardTitle>Office lease</CardTitle></CardHeader>
<CardBody>Waiting for the landlord's signature.</CardBody>
</Card>
A screen must match IBM product UIs that use Carbon for IBM Products' ProductiveCard or ExpressiveCard.
The parts
Every part is optional; put them in this order.
Part
Holds
ui-card-media
An image or video across the card, at ratio
ui-card-header
The header grid: ui-card-header-media, ui-card-title-media, ui-card-title, ui-card-actions
ui-card-header-media
A pictogram across the top of the header, at most 64px tall
ui-card-title-media
A logo before the title, 48–64px
ui-card-title
A label above, the title, a description below
ui-card-actions
Small buttons in the header's top-end corner
ui-card-body
The content, with 16px padding (none with is-flush)
ui-card-footer
Text, or a row of ui-card-actions
ui-card-action
One button in the footer or in ui-card-actions
Non-disclosure agreementTwo-way NDA in Thai and English, approved by the legal department.Last reviewed 1 September 2026
HTMLReactReact + Tailwind<ui-cardstyle="max-width: 360px">
<ui-card-header>
<ui-card-header-media>
<svgwidth="48"height="48"viewBox="0 0 32 32"fill="none"stroke="currentColor"aria-hidden="true"><pathd="M8 3h11l5 5v21H8zM19 3v5h5M12 14h8M12 18h8M12 22h5" /></svg>
</ui-card-header-media>
<ui-card-titlelabel="Template"description="Used 128 times">Non-disclosure agreement</ui-card-title>
</ui-card-header>
<ui-card-body>Two-way NDA in Thai and English, approved by the legal department.</ui-card-body>
<ui-card-footer>Last reviewed 1 September 2026</ui-card-footer>
</ui-card><UiCardstyle={{ maxWidth:360 }}>
<UiCardHeader>
<UiCardHeaderMedia>{documentPictogram}</UiCardHeaderMedia>
<UiCardTitlelabel="Template"description="Used 128 times">Non-disclosure agreement</UiCardTitle>
</UiCardHeader>
<UiCardBody>Two-way NDA in Thai and English, approved by the legal department.</UiCardBody>
<UiCardFooter>Last reviewed 1 September 2026</UiCardFooter>
</UiCard><CardclassName="max-w-[360px]">
<CardHeader>
<CardHeaderMedia>{documentPictogram}</CardHeaderMedia>
<CardTitlelabel="Template"description="Used 128 times">Non-disclosure agreement</CardTitle>
</CardHeader>
<CardBody>Two-way NDA in Thai and English, approved by the legal department.</CardBody>
<CardFooter>Last reviewed 1 September 2026</CardFooter>
</Card>
Media
ui-card-media fills the card's width at ratio: 16x9, 9x16, 2x1, 1x2, 4x3, 3x4, 3x2, 2x3 or 1x1. The image covers the box and is cropped to fit. Without ratio it keeps the image's own shape.
Give the image alt="" when it only decorates, and a real alt when it carries information the text doesn't.
Logo beside the title
ui-card-title-media puts a logo or an avatar before the title; the title moves over to make room.
Siam Logistics Co., Ltd.Freight and warehousing. 14 active contracts.
HTMLReactReact + Tailwind<ui-cardstyle="max-width: 360px">
<ui-card-header>
<ui-card-title-media>
<svgwidth="48"height="48"viewBox="0 0 48 48"aria-hidden="true"><rectwidth="48"height="48"style="fill: var(--ui-primary)" /><textx="24"y="30"fill="#ffffff"font-family="sans-serif"font-size="16"text-anchor="middle">SL</text></svg>
</ui-card-title-media>
<ui-card-titlelabel="Supplier"description="Bangkok · since 2019">Siam Logistics Co., Ltd.</ui-card-title>
</ui-card-header>
<ui-card-body>Freight and warehousing. 14 active contracts.</ui-card-body>
</ui-card><UiCardstyle={{ maxWidth:360 }}>
<UiCardHeader>
<UiCardTitleMedia>{supplierLogo}</UiCardTitleMedia>
<UiCardTitlelabel="Supplier"description="Bangkok · since 2019">Siam Logistics Co., Ltd.</UiCardTitle>
</UiCardHeader>
<UiCardBody>Freight and warehousing. 14 active contracts.</UiCardBody>
</UiCard><CardclassName="max-w-[360px]">
<CardHeader>
<CardTitleMedia>{supplierLogo}</CardTitleMedia>
<CardTitlelabel="Supplier"description="Bangkok · since 2019">Siam Logistics Co., Ltd.</CardTitle>
</CardHeader>
<CardBody>Freight and warehousing. 14 active contracts.</CardBody>
</Card>
Title, label and description
ui-card-title holds the title text. label goes above it and description below, both in small muted text. For markup in them, use the label and description slots instead. Icons go before or after the title in the title-start and title-end slots (titleStart and titleEnd in React + Tailwind).
Supply agreement C-2026-014
Chiang Mai plantSigned by both parties on 2 October 2026Delivery of packaging materials, monthly, until December 2027.
HTMLReactReact + Tailwind<ui-cardstyle="max-width: 360px">
<ui-card-header>
<ui-card-title>
Supply agreement C-2026-014
<svgslot="title-end"width="16"height="16"viewBox="0 0 16 16"fill="currentColor"aria-label="Signed"role="img"><pathd="M8 1a7 7 0 1 0 0 14A7 7 0 0 0 8 1ZM7 11 4.3 8.3l.9-.8L7 9.3l4-3.9.9.8L7 11Z" /></svg>
<spanslot="label">Chiang Mai plant</span>
<spanslot="description">Signed by <b>both parties</b> on 2 October 2026</span>
</ui-card-title>
</ui-card-header>
<ui-card-body>Delivery of packaging materials, monthly, until December 2027.</ui-card-body>
</ui-card><UiCardstyle={{ maxWidth:360 }}>
<UiCardHeader>
<UiCardTitle>
Supply agreement C-2026-014
<svgslot="title-end"width="16"height="16"viewBox="0 0 16 16"fill="currentColor"aria-label="Signed"role="img">…</svg>
<spanslot="label">Chiang Mai plant</span>
<spanslot="description">Signed by <b>both parties</b> on 2 October 2026</span>
</UiCardTitle>
</UiCardHeader>
<UiCardBody>Delivery of packaging materials, monthly, until December 2027.</UiCardBody>
</UiCard><CardclassName="max-w-[360px]">
<CardHeader>
<CardTitlelabel="Chiang Mai plant"description={<>Signed by <b>both parties</b> on 2 October 2026</>}
titleEnd={<svgwidth="16"height="16"viewBox="0 0 16 16"fill="currentColor"aria-label="Signed"role="img">…</svg>}
>
Supply agreement C-2026-014
</CardTitle>
</CardHeader>
<CardBody>Delivery of packaging materials, monthly, until December 2027.</CardBody>
</Card>
Cut long text
Long titles wrap. title-truncate cuts the title instead: on its own to one line with an ellipsis, with a number to that many lines. label-truncate and description-truncate work the same. max-width limits how wide a cut title gets.
Memorandum of understanding on joint procurement between three provincial officesMemorandum of understanding on joint procurement between three provincial offices
HTMLReactReact + Tailwind<divstyle="display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 16px; align-items: start">
<ui-card>
<ui-card-header>
<ui-card-titletitle-truncatedescription="Title and description on one line each"description-truncate>Memorandum of understanding on joint procurement between three provincial offices</ui-card-title>
</ui-card-header>
</ui-card>
<ui-card>
<ui-card-header>
<ui-card-titletitle-truncate="2"description="The description is cut to one line when it is longer than the card is wide"description-truncate="1">Memorandum of understanding on joint procurement between three provincial offices</ui-card-title>
</ui-card-header>
</ui-card>
</div><UiCard>
<UiCardHeader>
<UiCardTitletitleTruncate=""description="Title and description on one line each"descriptionTruncate="">Memorandum of understanding on joint procurement between three provincial offices</UiCardTitle>
</UiCardHeader>
</UiCard>
<UiCard>
<UiCardHeader>
<UiCardTitletitleTruncate="2"description="The description is cut to one line when it is longer than the card is wide"descriptionTruncate="1">Memorandum of understanding on joint procurement between three provincial offices</UiCardTitle>
</UiCardHeader>
</UiCard><Card>
<CardHeader>
<CardTitletitleTruncatedescription="Title and description on one line each"descriptionTruncate>Memorandum of understanding on joint procurement between three provincial offices</CardTitle>
</CardHeader>
</Card>
<Card>
<CardHeader>
<CardTitletitleTruncate={2} description="The description is cut to one line when it is longer than the card is wide"descriptionTruncate={1}>Memorandum of understanding on joint procurement between three provincial offices</CardTitle>
</CardHeader>
</Card>
On the element these are attributes whose presence means one line (in React pass "", or the number of lines as a string). React + Tailwind takes true or a number.
Header actions
ui-card-actions puts small buttons in the header's top-end corner, in at most half its width. Put each ui-icon-button kind="ghost" size="sm" in a ui-card-action. Buttons that don't fit move into an overflow menu; choosing an item clicks that button. The narrow card shows it.
Branch renovationSilom branch, second floor. Contractor starts on 1 November.NarrowTwo buttons go to the menu.
An item in the overflow menu is named by the action's label, else by its button's label or text. overflow-menu-label names the menu button ("More actions" by default, translated).
Footer actions
A ui-card-footer with ui-card-actions becomes a row of buttons across the card under a thin line: a ui-button stretches to share the row, a ui-icon-button keeps its size at the end. A footer with plain content just pads it.
Monthly contract summary48 contracts signed, 5 expiring in the next 30 days.View report
With href the whole card is one link and a single tab stop. Name it with label: the card's whole text would be a long link name. A linked card gets a border and the hover colour, and hides its footer: one link can't hold other controls, so leave out header actions too. They still show if you add them (as in Carbon, whose guidelines say a clickable card holds no interactive elements), inside the link. A plain click fires a cancelable ui-navigate first, for your SPA router.
Procurement policyWho can approve purchases, and up to what amount.
HTMLReactReact + Tailwind<ui-cardhref="#accessibility"label="Open the procurement policy"style="max-width: 360px">
<ui-card-header>
<ui-card-titlelabel="Policy"description="Version 4, 2026">Procurement policy</ui-card-title>
</ui-card-header>
<ui-card-body>Who can approve purchases, and up to what amount.</ui-card-body>
</ui-card><UiCardhref="/policies/procurement"label="Open the procurement policy"style={{ maxWidth:360 }}>
<UiCardHeader>
<UiCardTitlelabel="Policy"description="Version 4, 2026">Procurement policy</UiCardTitle>
</UiCardHeader>
<UiCardBody>Who can approve purchases, and up to what amount.</UiCardBody>
</UiCard><Cardhref="/policies/procurement"aria-label="Open the procurement policy"className="max-w-[360px]">
<CardHeader>
<CardTitlelabel="Policy"description="Version 4, 2026">Procurement policy</CardTitle>
</CardHeader>
<CardBody>Who can approve purchases, and up to what amount.</CardBody>
</Card>
target="_blank" opens a new tab; the card adds "(opens in a new tab)" for screen readers and rel="noopener noreferrer".
Clickable card
clickable makes the whole card one button: a click, or Enter or Space while the card has focus, fires click. An arrow in the bottom-end corner shows it can be pressed; replace it with the footer-icon slot (footerIcon in React + Tailwind). Name the card with label, and put no other controls in it.
Sale contractGoods, price and delivery.Lease contractProperty, rent and term.
Chosen:
HTMLReactReact + Tailwind<divstyle="display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 16px">
<ui-cardid="card-pick-sale"clickablelabel="Start a sale contract">
<ui-card-header><ui-card-titlelabel="Template">Sale contract</ui-card-title></ui-card-header>
<ui-card-body>Goods, price and delivery.</ui-card-body>
</ui-card>
<ui-cardid="card-pick-lease"clickablelabel="Start a lease contract">
<ui-card-header><ui-card-titlelabel="Template">Lease contract</ui-card-title></ui-card-header>
<ui-card-body>Property, rent and term.</ui-card-body>
</ui-card>
</div>
<p>Chosen: <outputid="card-pick-out">nothing yet</output></p>
<scripttype="module">
const out = document.getElementById('card-pick-out');
for (const id of ['card-pick-sale', 'card-pick-lease']) {
const card = document.getElementById(id);
card.addEventListener('click', () => (out.value = card.label));
}
</script>const [chosen, setChosen] =useState('');
<UiCardclickablelabel="Start a sale contract"onClick={() =>setChosen('sale')}>
<UiCardHeader><UiCardTitlelabel="Template">Sale contract</UiCardTitle></UiCardHeader>
<UiCardBody>Goods, price and delivery.</UiCardBody>
</UiCard>
<UiCardclickablelabel="Start a lease contract"onClick={() =>setChosen('lease')}>
<UiCardHeader><UiCardTitlelabel="Template">Lease contract</UiCardTitle></UiCardHeader>
<UiCardBody>Property, rent and term.</UiCardBody>
</UiCard>
<p>Chosen: <output>{chosen}</output></p>const [chosen, setChosen] =useState('');
<Cardclickablearia-label="Start a sale contract"onClick={() =>setChosen('sale')}>
<CardHeader><CardTitlelabel="Template">Sale contract</CardTitle></CardHeader>
<CardBody>Goods, price and delivery.</CardBody>
</Card>
<Cardclickablearia-label="Start a lease contract"onClick={() =>setChosen('lease')}>
<CardHeader><CardTitlelabel="Template">Lease contract</CardTitle></CardHeader>
<CardBody>Property, rent and term.</CardBody>
</Card>
<p>Chosen: <output>{chosen}</output></p>
Selected card
Beyond Carbon (its card has no chosen state): selected on a clickable card says which one is chosen, for example the board the page shows. The card reports aria-pressed and takes the look of a checked selectable tile. It doesn't change by itself on a click: set it from your code, as the demo does.
Sale contracts12 contractsLease contracts4 contracts
Beyond Carbon: hide-footer-icon (hideFooterIcon in React + Tailwind) removes the clickable card's arrow and the row it takes, for small cards in a dense grid.
disabled greys the text and the arrow. A disabled clickable card fires no click and leaves the tab order; a disabled linked card is no longer a link. Say in the card why it can't be used.
Loan contractBeing revised by the legal department until 15 October.
HTMLReactReact + Tailwind<ui-cardclickabledisabledlabel="Start a loan contract (unavailable)"style="max-width: 320px">
<ui-card-header><ui-card-titlelabel="Template">Loan contract</ui-card-title></ui-card-header>
<ui-card-body>Being revised by the legal department until 15 October.</ui-card-body>
</ui-card><UiCardclickabledisabledlabel="Start a loan contract (unavailable)"style={{ maxWidth:320 }}>
<UiCardHeader><UiCardTitlelabel="Template">Loan contract</UiCardTitle></UiCardHeader>
<UiCardBody>Being revised by the legal department until 15 October.</UiCardBody>
</UiCard><Cardclickabledisabledaria-label="Start a loan contract (unavailable)"className="max-w-[320px]">
<CardHeader><CardTitlelabel="Template">Loan contract</CardTitle></CardHeader>
<CardBody>Being revised by the legal department until 15 October.</CardBody>
</Card>
Horizontal
horizontal puts the media beside the content: at the start by default, at the end with media-position="end". The media takes a third of the card; media-width on ui-card-media changes that.
Signing a contract onlineCheck the parties, sign with your one-time code, and download the signed copy.Asking for an approvalPick the approvers, add a note, and follow the request from your inbox.
HTMLReactReact + Tailwind<ui-cardhorizontalstyle="max-width: 560px">
<ui-card-media>
<imgalt=""src="data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 160 90'%3E%3Crect width='160' height='90' fill='%23d0e2ff'/%3E%3Cpath d='M66 20h22l10 10v40H66z' fill='%23ffffff'/%3E%3Cpath d='M72 42h20M72 50h20M72 58h12' stroke='%230f62fe' stroke-width='2'/%3E%3C/svg%3E" />
</ui-card-media>
<ui-card-header><ui-card-titlelabel="Guide"description="5 minutes to read">Signing a contract online</ui-card-title></ui-card-header>
<ui-card-body>Check the parties, sign with your one-time code, and download the signed copy.</ui-card-body>
</ui-card>
<ui-cardhorizontalmedia-position="end"style="max-width: 560px">
<ui-card-mediamedia-width="40%">
<imgalt=""src="data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 160 90'%3E%3Crect width='160' height='90' fill='%23d0e2ff'/%3E%3Cpath d='M66 20h22l10 10v40H66z' fill='%23ffffff'/%3E%3Cpath d='M72 42h20M72 50h20M72 58h12' stroke='%230f62fe' stroke-width='2'/%3E%3C/svg%3E" />
</ui-card-media>
<ui-card-header><ui-card-titlelabel="Guide"description="3 minutes to read">Asking for an approval</ui-card-title></ui-card-header>
<ui-card-body>Pick the approvers, add a note, and follow the request from your inbox.</ui-card-body>
</ui-card><UiCardhorizontalstyle={{ maxWidth:560 }}>
<UiCardMedia><imgalt=""src={guideImage} /></UiCardMedia>
<UiCardHeader><UiCardTitlelabel="Guide"description="5 minutes to read">Signing a contract online</UiCardTitle></UiCardHeader>
<UiCardBody>Check the parties, sign with your one-time code, and download the signed copy.</UiCardBody>
</UiCard>
<UiCardhorizontalmediaPosition="end"style={{ maxWidth:560 }}>
<UiCardMediamediaWidth="40%"><imgalt=""src={guideImage} /></UiCardMedia>
<UiCardHeader><UiCardTitlelabel="Guide"description="3 minutes to read">Asking for an approval</UiCardTitle></UiCardHeader>
<UiCardBody>Pick the approvers, add a note, and follow the request from your inbox.</UiCardBody>
</UiCard><CardhorizontalclassName="max-w-[560px]">
<CardMedia><imgalt=""src={guideImage} /></CardMedia>
<CardHeader><CardTitlelabel="Guide"description="5 minutes to read">Signing a contract online</CardTitle></CardHeader>
<CardBody>Check the parties, sign with your one-time code, and download the signed copy.</CardBody>
</Card>
<CardhorizontalmediaPosition="end"className="max-w-[560px]">
<CardMediamediaWidth="40%"><imgalt=""src={guideImage} /></CardMedia>
<CardHeader><CardTitlelabel="Guide"description="3 minutes to read">Asking for an approval</CardTitle></CardHeader>
<CardBody>Pick the approvers, add a note, and follow the request from your inbox.</CardBody>
</Card>
Expressive
density="expressive" sets the title in the larger heading-03 type, for marketing-like pages with few cards. The default productive suits dense product screens.
E-signature for every branchFrom November, every branch can sign contracts online.
HTMLReactReact + Tailwind<ui-carddensity="expressive"style="max-width: 360px">
<ui-card-header><ui-card-titlelabel="New">E-signature for every branch</ui-card-title></ui-card-header>
<ui-card-body>From November, every branch can sign contracts online.</ui-card-body>
</ui-card><UiCarddensity="expressive"style={{ maxWidth:360 }}>
<UiCardHeader><UiCardTitlelabel="New">E-signature for every branch</UiCardTitle></UiCardHeader>
<UiCardBody>From November, every branch can sign contracts online.</UiCardBody>
</UiCard><Carddensity="expressive"className="max-w-[360px]">
<CardHeader><CardTitlelabel="New">E-signature for every branch</CardTitle></CardHeader>
<CardBody>From November, every branch can sign contracts online.</CardBody>
</Card>
On a layer
A card draws itself in the layer colour it sits on. Inside a ui-layer it takes the next one, so cards on a grey panel still stand out.
12 open dealsWorth 3.4 million baht.5 reviews2 due this week.
HTMLReactReact + Tailwind<ui-layerlevel="1"with-backgroundstyle="display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 16px; padding: 16px">
<ui-card>
<ui-card-header><ui-card-titlelabel="Sales">12 open deals</ui-card-title></ui-card-header>
<ui-card-body>Worth 3.4 million baht.</ui-card-body>
</ui-card>
<ui-card>
<ui-card-header><ui-card-titlelabel="Legal">5 reviews</ui-card-title></ui-card-header>
<ui-card-body>2 due this week.</ui-card-body>
</ui-card>
</ui-layer><UiLayerlevel={1} withBackgroundstyle={{ display:'grid', gridTemplateColumns:'repeat(auto-fill, minmax(220px, 1fr))', gap:16, padding:16 }}>
<UiCard>
<UiCardHeader><UiCardTitlelabel="Sales">12 open deals</UiCardTitle></UiCardHeader>
<UiCardBody>Worth 3.4 million baht.</UiCardBody>
</UiCard>
<UiCard>
<UiCardHeader><UiCardTitlelabel="Legal">5 reviews</UiCardTitle></UiCardHeader>
<UiCardBody>2 due this week.</UiCardBody>
</UiCard>
</UiLayer><Layerlevel={1} withBackgroundclassName="grid grid-cols-[repeat(auto-fill,minmax(220px,1fr))] gap-4 p-4">
<Card>
<CardHeader><CardTitlelabel="Sales">12 open deals</CardTitle></CardHeader>
<CardBody>Worth 3.4 million baht.</CardBody>
</Card>
<Card>
<CardHeader><CardTitlelabel="Legal">5 reviews</CardTitle></CardHeader>
<CardBody>2 due this week.</CardBody>
</Card>
</Layer>
Keyboard
Key
Does
Tab
Moves to a linked or clickable card, or to the buttons in a plain card's header and footer
Enter
Follows a linked card; presses a clickable card
Space
Presses a clickable card
Accessibility
The title is not a heading element. When the cards form a list with headings on the page, wrap the title text in a heading of the right level, or name the list.
A linked or clickable card is one control. Name it with label, since its whole text would make a long name, and don't put other controls inside.
A clickable card is a role="button"; a disabled one has aria-disabled and leaves the tab order.
The arrow of a clickable card and the media are decorative. Give an image a real alt only when it carries information.
The header actions are separate buttons, each with its own label; those in the overflow menu keep their names.
Unstyled React parts with the same behaviour: Headless Card.
API
Generated from the package. In React, pass a property as a prop of the same name; events are props too (the React column).
<ui-card> · React UiCard
Attributes
Attribute
Property
Type
Default
Description
href
href
string
''
Makes the whole card one link.
target
target
'_self' | '_blank'
'_self'
clickable
clickable
boolean
false
Makes the whole card one button (listen for click).
selected
selected
boolean | undefined
A clickable card shown chosen, as a checked selectable tile, with aria-pressed (beyond Carbon; the app toggles it).
hide-footer-icon
hideFooterIcon
boolean
false
Removes the clickable card's arrow footer (beyond Carbon).
disabled
disabled
boolean
false
label
label
string
''
The accessible name of a linked or clickable card (Carbon asks for one).
density
density
CardDensity
'productive'
horizontal
horizontal
boolean
false
media-position
mediaPosition
'start' | 'end'
'start'
Where a horizontal card's media goes.
Events
Event
React
Description
ui-navigate
none (use a ref)
detail: { href } (cancelable) on a plain click of a linked card; cancel it to route client-side (README: SPA router)
Slots
Slot
Description
(default)
The parts
media
(filled for you) the media of a horizontal card
footer-icon
Replaces the clickable card's arrow
CSS parts
Part
Description
base
The card (<div>, or <a> with href)
CSS custom properties
Custom property
Default
Description
--ui-card-radius
Corner radius (default 0; Kanok: 12px)
--ui-card-border
Border of every card, not only clickable ones (default none; Kanok: a hairline)
--ui-card-background
Its fill (default --ui-surface-1; Kanok paper: a cool grey that sets it apart from the page, no border)
--ui-card-clickable-border
Border of a clickable card (default 1px --ui-border-tile-1; Kanok: none)
--ui-card-overflow
overflow of the card (default visible; Kanok: clip, so media follow the rounded corners)
--ui-tile-selected-border
Border of a selected card, as a checked tile's (default --ui-layer-selected-inverse); --ui-tile-selected-background / --ui-tile-selected-hover its fill
<ui-card-media> · React UiCardMedia
Attributes
Attribute
Property
Type
Default
Description
ratio
ratio
CardMediaRatio | ''
''
media-width
mediaWidth
string
'33.33%'
A horizontal card's media width (Carbon's default 33.33%).