Card
Primary content surface with header/body/footer sub-seams for dashboard composition.
All components · Theme builder · Implementation source
Live preview
Install
netscript ui:add cardUsage and examples
The preview runs this JSX with the installed components. Import any composed primitives from your UI directory.
import { useState } from 'preact/hooks';
import { Button } from '@app/components/ui/button.tsx';
import { Card } from '@app/components/ui/card.tsx';
import { Input } from '@app/components/ui/input.tsx';
export function Example() {
const [value, setValue] = useState('standard');
const [open, setOpen] = useState(false);
const [notice, report] = useState('');
return (<><div><Card><Card.Header><Card.Title>Order SO–10480</Card.Title><Card.Description>Review fulfillment details</Card.Description></Card.Header><Card.Body><Input aria-label="Tracking number" placeholder="Tracking number" /></Card.Body><Card.Footer><Button onClick={() => report("Order saved")}>Save changes</Button></Card.Footer></Card></div><p role="status">{notice}</p></>);
}Props
Generated from native deno doc --json --private over the shipped implementation. Compound component props retain their owning interface; native attributes pass through where declared.
| Owner | Prop | Type | Optional | Description |
|---|---|---|---|---|
CardSectionProps | children | Renderable | No | |
CardSectionProps | class | string | Yes | |
CardSectionProps | data-part | string | Yes | |
CardSectionProps | data-scope | string | Yes | |
CardProps | interactive | boolean | Yes | |
CardProps | variant | "default" | "rule" | Yes | |
CardProps | size | "md" | "sm" | Yes | |
CardProps | state | "rest" | "hover" | "focus" | "selected" | Yes | Visual snapshot; native child controls remain the keyboard targets. |
CardTextProps | data-scope | string | Yes | |
CardTextProps | children | Renderable | No | |
CardTextProps | class | string | Yes |
CardSectionProps extends Omit<JSX.HTMLAttributes<HTMLDivElement>, "class" | "children">
CardProps extends CardSectionProps
CardTextProps extends Omit<JSX.HTMLAttributes<HTMLParagraphElement>, "class" | "children">Keyboard
| Key | Action |
|---|---|
Tab/Shift+Tab | Focus native child actions; the card container adds no keyboard target |
Tokens
Semantic contract roles: border/control, border/strong, border/subtle, radius/card, space/card/padding, space/stack/gap, surface/card, surface/surface, text/card, text/muted.
CSS custom properties referenced directly: --ns-border, --ns-border-control, --ns-border-strong, --ns-border-subtle, --ns-border-width, --ns-card, --ns-card-bg, --ns-card-border, --ns-card-border-bottom, --ns-card-border-side, --ns-card-border-top, --ns-card-footer, --ns-component-card-bg, --ns-component-card-fg, --ns-component-card-padding, --ns-component-card-radius, --ns-focus-ring-offset, --ns-focus-ring-width, --ns-hover, --ns-leading-heading, --ns-leading-small, --ns-motion-duration-normal, --ns-motion-easing-normal, --ns-ring, --ns-selected, --ns-shadow-sm, --ns-shadow-xs, --ns-space-4, --ns-space-5, --ns-space-6, --ns-stack-gap, --ns-surface, --ns-text-heading, --ns-text-sm, --ns-text-small, --ns-tracking-heading, --ns-tracking-normal, --ns-weight-heading.
Contract and compatibility
Accessibility pattern: noninteractive presentation
- Native DOM attributes pass through where the implementation accepts them.
- Header/body/footer presence comes from namespace composition, not phantom boolean root props. Rule has only a top border, with no resting fill/radius/shadow.
Design contract values marked planned are not implementation props. The props above describe what ships today.