GitHubGitHub
← All components
Layout / component

Card

A bordered surface with optional header and footer bands, divided by hairlines and inset by a single padding switch.

Body onlyHeaderFooterFlush
api-gateway
Deployed 14 minutes ago from the release branch.
Owner: ana@example.com
<Card>  {#snippet header()}<strong>api-gateway</strong>{/snippet}  Deployed 14 minutes ago from the release branch.  {#snippet footer()}<span>Owner: ana@example.com</span>{/snippet}</Card>

Installation

pnpm add @chanrg/4ui

Import the stylesheet once, at the root of your app:

import '@chanrg/4ui/styles.css';

Usage

import { Card } from '@chanrg/4ui';<Card>  {#snippet header()}<strong>api-gateway</strong>{/snippet}  Deployed 14 minutes ago from the release branch.  {#snippet footer()}<span>Owner: ana@example.com</span>{/snippet}</Card>

Flush

Turn padded off when the body is a table, a chart, or media that should meet the border directly.

Projects
Projects
Requests428.6
Response time82.1
CPU load78.4
Queue depth3.1
<Card padded={false}>  {#snippet header()}<strong>Projects</strong>{/snippet}  <DataTable {columns} {rows} /></Card>

API reference

Props

PropTypeDefaultDescription
paddedbooleantrueApplies the standard inset to every section. Turn off for flush media or tables.
header / children / footerSnippetEach band renders only when supplied, so a body-only card carries no dividers.

CSS variables

VariableDescription
--4ui-surfacePrimary component surface.
--4ui-textPrimary foreground color.
--4ui-borderDefault control and panel border.
--4ui-border-softHairline under the header and above the footer.
--4ui-shadow-cardResting elevation of the surface.

Accessibility

  • A plain container: the headings, landmarks, and controls you render inside keep their own semantics.
  • Section dividers are borders rather than separators, so nothing extra is announced.

Dependencies

No runtime component dependencies.