Skip to main content
NetScriptdocs Search docs ⌘K v0.0.9
Browse documentation

Card

Primary content surface with header/body/footer sub-seams for dashboard composition.

All components · Theme builder · Implementation source

Live preview

Open live card preview

Install

Shell
netscript ui:add card

Usage and examples

The preview runs this JSX with the installed components. Import any composed primitives from your UI directory.

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

OwnerPropTypeOptionalDescription
CardSectionPropschildrenRenderableNo
CardSectionPropsclassstringYes
CardSectionPropsdata-partstringYes
CardSectionPropsdata-scopestringYes
CardPropsinteractivebooleanYes
CardPropsvariant"default" | "rule"Yes
CardPropssize"md" | "sm"Yes
CardPropsstate"rest" | "hover" | "focus" | "selected"YesVisual snapshot; native child controls remain the keyboard targets.
CardTextPropsdata-scopestringYes
CardTextPropschildrenRenderableNo
CardTextPropsclassstringYes
TypeScript
CardSectionProps extends Omit<JSX.HTMLAttributes<HTMLDivElement>, "class" | "children">
CardProps extends CardSectionProps
CardTextProps extends Omit<JSX.HTMLAttributes<HTMLParagraphElement>, "class" | "children">

Keyboard

KeyAction
Tab/Shift+TabFocus 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.

Search all documentation

Type a term to search the documentation.