Hulian UIv0.93.5413 components0 components
  • Start
  • Components
  • Blocks
  • Pages
  • Demos
  • Changelog
ChineseEnglish
  • ComponentsComponents
  • ThemeTheme

Collections

  • QuestionCard
  • Table
  • Book3D
  • ProTable
  • PricingTable
  • JsonViewer
  • EditableTable
  • List
  • Descriptions
  • RowActions
  • Tree
  • Card
  • Carousel
  • Video
  • Audio
  • BentoGrid
  • Image
  • MagicCard
  • AnimatedList
  • Marquee
  • Sortable
  • Kanban
  • DesignCanvas
  • LayerTree
  • StageDraw
  • SlideDeck
  • PresenterView
  • ComponentPicker
  • EventStream
  • QueueLane
  • DocumentSheet
  • Novel reader
  • Scheduler
  • Org classroom
  • Danmaku
  • LiveChat
  • LivePlayer
  • LogViewer
  • FileTree
  • CodeReviewThread
  • VirtualList
  • InfiniteScroll
  • LogoLoop
  • BounceCards
  • CardSwap
  • ChromaGrid
  • CircularGallery
  • DomeGallery
  • FlyingPosters
  • InfiniteMenu
  • MagicBento
  • ScrollStack
  • ProfileCard
  • TiltedCard
  • PixelCard
  • DecayCard
  • ReflectiveCard
  • Folder

Charts and Diagrams

  • Flow
  • Diagram
  • Paper
  • SequenceDiagram
  • Sankey
  • Sparkline
  • Funnel
  • Treemap
  • Gantt
  • Heatmap
  • ContributionGraph
  • Legend
  • Chart
  • WorldMap

Information

  • ImageViewer
  • LiveProductCard
  • DiffStat
  • ScoreRing
  • ScoreScale
  • Badge
  • Dot
  • StatusDot
  • Chip
  • FilterChip
  • Coupon
  • Tag
  • Annotation
  • Avatar
  • AvatarCircles
  • User
  • QRCode
  • Comment
  • RelativeTime
  • GitCommit
  • DeployStatus
  • ShieldBadge
  • AwardBadge
  • CreditCard
  • IconTile

Metrics

  • Stat
  • Statistic
  • Meter
  • Timeline
  • NumberTicker

Placeholders

  • Empty
  • Skeleton
  • Watermark

Card

card

Groups related content into header, body, and footer regions.

Usage

Basic usage

outline stroke card, composed of three sections: CardHeader / CardBody / CardFooter.

Hulian Card
The jades from the ancestral temple are both beautiful and useful. Appearance + ease of use are the primary productivity.
footer area
tsx
<Card variant="outline" className="w-64">
  <CardHeader>Hulian Card</CardHeader>
  <CardBody> Ancestral temple jade, extremely beautiful and useful. Appearance + ease of use are the primary productivity. </CardBody>
  <CardFooter>footer District</CardFooter>
</Card>

Floating Card

elevated replaces the solid border with shadow, and the shadow deepens in hover.

Hulian Card
The jades from the ancestral temple are both beautiful and useful. Appearance + ease of use are the primary productivity.
footer area
tsx
<Card variant="elevated" className="w-64">
  <CardHeader>Hulian Card</CardHeader>
  <CardBody> Ancestral temple jade, extremely beautiful and useful. Appearance + ease of use are the primary productivity. </CardBody>
  <CardFooter>footer District</CardFooter>
</Card>

Default and compact density

md is the default; sm tightens all three regions together. CardBody no longer assigns a font size, so its content owns typography.

Runtime metrics

98.7%

Last 5 minutes
Runtime metrics

98.7%

Last 5 minutes
tsx
<div className="flex flex-wrap gap-4">
  <Card className="w-64">
    <CardHeader title="Runtime metrics" />
    <CardBody><Text size="lg">98.7%</Text></CardBody>
    <CardFooter>Last 5 minutes</CardFooter>
  </Card>
  <Card size="sm" className="w-64">
    <CardHeader title="Runtime metrics" />
    <CardBody><Text size="lg">98.7%</Text></CardBody>
    <CardFooter>Last 5 minutes</CardFooter>
  </Card>
</div>

Highlight Card

featured Use primary double-line stroke to highlight recommended items, aligned within the grid without offset.

Hulian Card
The jades from the ancestral temple are both beautiful and useful. Appearance + ease of use are the primary productivity.
footer area
tsx
<Card variant="featured" className="w-64">
  <CardHeader>Hulian Card</CardHeader>
  <CardBody> Ancestral temple jade, extremely beautiful and useful. Appearance + ease of use are the primary productivity. </CardBody>
  <CardFooter>footer District</CardFooter>
</Card>

No chrome

plain draws no border, background, or shadow, leaving only the corner radius and the slot roles. Use it when an outer container already provides the chrome, otherwise you get a doubled border.

Hulian Card
The jades from the ancestral temple are both beautiful and useful. Appearance + ease of use are the primary productivity.
tsx
{/* The outer container owns the chrome, Card owns the structure */}
<div className="rounded-[var(--radius)] border border-primary/40 bg-primary/5 p-1">
  <Card variant="plain" className="w-64">
    <CardHeader>Hulian Card</CardHeader>
    <CardBody> Ancestral temple jade, extremely beautiful and useful. Appearance + ease of use are the primary productivity. </CardBody>
  </Card>
</div>

None footer

All three sections are optional, only Header + Body is also established.

Hulian Card
The jades from the ancestral temple are both beautiful and useful. Appearance + ease of use are the primary productivity.
tsx
<Card variant="outline" className="w-64">
  <CardHeader>Hulian Card</CardHeader>
  <CardBody> Ancestral temple jade, extremely beautiful and useful. Appearance + ease of use are the primary productivity. </CardBody>
</Card>

Remove the section rules

divided={false} makes the header and the body read as one block, and tightens the padding the rule used to hold open.

With a rule
The default: a rule cuts the header away from the body.
Without a rule
The header and the body are one block.
tsx
<Card divided={false} className="w-64">
  <CardHeader>Pending approvals</CardHeader>
  <CardBody>Three items are waiting for review.</CardBody>
</Card>

Title / description / extra

Pass title to CardHeader and the heading gets an element of its own: icons and tags on the same row are no longer painted with the header font-medium, and extra aligns itself to the right.

Assign tasksBy role
Assign in bulk by role, effective immediately
Three items awaiting action.
tsx
<Card className="w-80">
  <CardHeader
    title={<>Assign tasks<Tag>By role</Tag></>}
    description="Assign in bulk by role, effective immediately"
    extra={<Button variant="ghost" size="sm">Expand</Button>}
  />
  <CardBody>Three items are waiting for review.</CardBody>
</Card>

Primary card

variant="primary" has a primary gradient and sets data-surface="inverse", so text and tags inside switch to inverse colors automatically; the progress bar uses tone="inverse".

Ongoing

The whole palette follows your theme

Assigned to Abel

68%
tsx
<Card variant="primary" className="w-72">
  <CardBody className="space-y-4">
    <Tag size="sm">In progress</Tag>
    <Text weight="semibold">The whole palette follows your theme</Text>
    <Text size="sm" tone="muted">Assigned to Abel</Text>
    <Progress value={68} showValue tone="inverse" />
  </CardBody>
</Card>

Fully clickable card

interactive lifts the card on hover and shows a ring on keyboard focus; render turns the whole card into a link, so don't put other links or buttons inside.

Hulian Documentation
hulian.dev
Components, blocks, pages, and templates.
tsx
<Card variant="elevated" interactive render={<a href="/docs" />}>
  <CardHeader title="Hulian docs" description="hulian.dev" />
  <CardBody>Components, blocks, pages, and templates.</CardBody>
</Card>

When to use

Use Card to group related content in a bordered or elevated container. Use List for an item stream or grid, and Descriptions for key-value details. Card is a structural shell with no business behavior.

Import

ts
import { Card, CardHeader, CardBody, CardFooter, Text } from "@hulianui/ui"

Props

CardProps inherits HTMLAttributes<HTMLDivElement> and adds a CVA variant:

NameTypeDefaultDescription
variant"outline" | "elevated" | "featured" | "primary" | "plain""outline"Border, raised shadow, emphasized, primary, or no chrome at all. primary has a primary-color gradient and sets data-surface="inverse", so Text, Tag, Chip, and Avatar inside switch to inverse colors automatically; components filled with the primary color (Progress) use tone="inverse".
interactivebooleanfalseMakes the whole card clickable: it lifts and deepens its shadow on hover and shows a focus ring. Usually paired with render.
renderReactElement-Renders the whole card as a custom element (<a href> or a framework router link). Styling and props merge into it and children render as usual. Don't put other links or buttons inside.
size"sm" | "md""md"Whole-card density. md falls back to global --hl-card-px, --hl-card-py, --hl-card-header-py, and --hl-card-footer-py tokens (overridable on :root), and the root exposes data-slot="card" and data-variant. sm tightens the Header, Body, and Footer padding together.
dividedbooleantrueWhether a rule separates CardHeader / CardFooter from the body. Setting false removes both rules and tightens the padding they used to hold open.

CardBody and CardFooter accept native div properties and children. CardBody no longer assigns a font size: its content owns typography, whether you use plain text or an explicit Text size.

CardHeaderProps (also inherits HTMLAttributes<HTMLDivElement> except title, whose type is widened to ReactNode)

NameTypeDefaultDescription
titleReactNode-The heading. It gets an element of its own (data-slot="card-title") and therefore its own size, leading, and weight.
descriptionReactNode-Supporting text below the heading, in the secondary text color.
extraReactNode-Trailing action area (buttons, switches, counts), vertically centered against the heading group and always on the same line: wrapping is decided independently of content length, so a long description never pushes it to a second row.

"Present" means the same thing it does for PageHeader's meta: null, undefined, false, and "" all count as not passed, so title={isEditing && "Editing"} does not switch layouts when the condition is false.

With none of the three passed, CardHeader stays the bare slot it is today: children is the content and the container carries font-medium. Passing any of them switches to a two-column heading / action layout, and font-medium moves off the container onto the title element, so icons, Tags, and counts on the same row are no longer painted with heading weight. children remains the escape hatch and renders after the title and description, still in the left column.

plain is the no-chrome variant: no border, no background, no shadow, just the corner radius, the text color, and the three slot roles. Use it when the container already gets its appearance from somewhere else: a hero style the page brings along during a migration, an outer card that already draws a frame, or a card sitting inside a gradient section. The other three variants all paint a background (bg-surface), so they produce a doubled border and a doubled surface. The Accordion and Collapsible panels take a plain prop with the same meaning: when the content brings its own appearance, the answer is no skin rather than a different skin.

Example

tsx
<Card variant="elevated" className="w-64">
  <CardHeader>Hulian Card</CardHeader>
  <CardBody>Designed for beauty and practical use.</CardBody>
<CardFooter>Footer</CardFooter>
</Card>

md is the default density. Use sm for denser information; all three regions tighten together while the body typography remains owned by its content:

tsx
<Card size="sm">
  <CardHeader title="Runtime metrics" />
  <CardBody>
    <Text size="lg">98.7%</Text>
  </CardBody>
  <CardFooter>Last 5 minutes</CardFooter>
</Card>

The "icon + heading + status tag + trailing action" row, the most common admin card header:

tsx
<Card>
  <CardHeader
    title={<><Users className="size-5 text-muted-foreground" />Assign tasks<Tag>By role</Tag></>}
    description="Assign in bulk by role; changes take effect immediately."
    extra={<Button variant="ghost" size="sm">Expand</Button>}
  />
  <CardBody>…</CardBody>
</Card>

A primary card (an emphasis card on a marketing page): text, tags, and avatars inside switch to inverse colors automatically; the progress bar uses tone="inverse":

tsx
<Card variant="primary">
  <CardBody>
    <Text weight="semibold">The whole palette follows your theme</Text>
    <Text size="sm" tone="muted">Assigned to Abel</Text>
    <Progress value={68} showValue tone="inverse" />
  </CardBody>
</Card>

A fully clickable card (site cards, portfolios):

tsx
<Card variant="elevated" interactive render={<a href="https://hulian.dev" target="_blank" rel="noreferrer" />}>
  <CardBody>…</CardBody>
</Card>

Usage notes

  • The Card root carries no padding of its own; content must go inside CardBody. The

root only sets the radius, the text color, and the density variables ([--card-body-px:1.25rem]
and friends); the three sections CardHeader / CardBody / CardFooter are what actually
consume those variables. So <Card><div>content</div></Card> has zero padding and sits
flush against the border. That is by design, not a bug. Note also that this library calls it
CardBody, not CardContent (shadcn/ui uses the latter, so muscle memory misfires here;
when it errors, reach for the right name rather than falling back to a bare div).

  • **If padding is gone card-wide, even with CardBody in place, suspect a missing @source

in the consumer first** (#336). Those density variables and px-[var(--card-body-px,1.25rem)]
are the only family in the library that writes spacing as an arbitrary value, and such
literals exist nowhere but Hulian's own source. Ordinary classes like px-4, gap-2 and
rounded-xl appear in consumer code too, so Tailwind emits them regardless. The result is
that a missing @source does not look like "no styles at all" but like "**borders, radii and
colors are all correct, yet every container lost its padding**" - which reads as a component
bug. The test: grep card-body-px in the built CSS; no match means @source is missing (see
consuming.md §8). Since @hulianui/tokens 0.12.0 the
preset ships a safelist that covers this family.

  • Do not wrap loading skeletons in Card. [[loading-skeletons-are-chromeless-dont-wrap-in-card]] explains why shimmer placeholders conventionally avoid borders and shadows.
  • A fixed outer minimum height combined with flex stretching can push a final metadata row outside the card background; see [[grid-card-button-tail-row-leaks-outside-when-outer-min-height]].
  • When the heading contains an icon or a Tag, pass title instead of packing the whole row into children: inside children, the header's font-medium paints the icon, the tag, and the count with heading weight, while the heading itself gets no size or leading of its own.
  • CardHeader's title is a ReactNode and collides with the native HTMLAttributes.title?: string, so the type omits title. Put a native tooltip on an inner element instead.
  • extra never drops to a second row because title or description grew (#263). The left column is flex: 1 1 0, so wrapping is decoupled from content length and long text truncates or clamps as written. The flip side is that extra keeps its slot even in a narrow card, squeezing the heading -- so give the heading an overflow treatment. Card width comes from the layout (a three-column grid, a sidebar) and has nothing to do with the viewport, which is why there is deliberately no "wrap on narrow screens" step here. PageHeader has one, because a page header is always full width and a narrow viewport does mean a narrow header.
  • divided={false} applies only to the direct children CardHeader and CardFooter, so a nested card does not inherit the outer value and must opt out itself. It is not delivered through context either: Card still has no "use client" and works inside a server component.
  • size="sm" is supplied by density variables on the Card root. A nested Card resets its own default md values and must explicitly receive size="sm" when it should be compact. Section className values such as p-0 and pt-0 still override the corresponding padding as before.

Related

Table · Book3D · ProTable · PricingTable · JsonViewer · EditableTable

Playground

Hulian Card
The jades from the ancestral temple are both beautiful and useful. Appearance + ease of use are the primary productivity.
footer area
<Card variant="outline">
  <CardHeader>Hulian Card</CardHeader>
  <CardBody>...</CardBody>
  <CardFooter>footer District</CardFooter>
</Card>
PreviousTreeData DisplayNextCarousel

On this page

  • Usage
  • Documentation
    • When to use
    • Import
    • Props
    • Example
    • Usage notes
    • Related
  • Playground