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

Donut

Token-driven donut/pie chart — SVG arc segments with a center total and legend; segment colors from data-tone or a semantic-token cycle.

All components · Theme builder · Implementation source

Live preview

Open live donut preview

Install

Shell
netscript ui:add donut

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 { Donut } from '@app/components/ui/donut.tsx';

export function Example() {
  const [value, setValue] = useState('standard');
  const [open, setOpen] = useState(false);
  const [notice, report] = useState('');
  return (<><div><Donut data={[{label:"Fulfilled",value:88},{label:"Pending",value:12}]} /></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
DonutPropsdataDonutDatum[]No
DonutPropstotalstring | numberYesOverride the center label (defaults to the sum).
DonutPropsclassstringYes
TypeScript
type DonutTone = "primary" | "success" | "warning" | "secondary" | "destructive"
DonutProps extends Omit<JSX.HTMLAttributes<HTMLDivElement>, "class">

Keyboard

Presentation component; no component-specific keyboard interactions.

Tokens

Semantic contract roles: material/track, radius/badge, text/fg, text/muted.

CSS custom properties referenced directly: --ns-chart-1, --ns-chart-2, --ns-chart-3, --ns-chart-4, --ns-chart-5, --ns-destructive, --ns-ease-normal, --ns-fg, --ns-font-kpi, --ns-font-mono, --ns-font-sans, --ns-leading-normal, --ns-leading-small, --ns-primary, --ns-radius-control, --ns-radius-sm, --ns-secondary, --ns-secondary-text, --ns-space-1-5, --ns-space-2, --ns-space-2-5, --ns-space-24, --ns-space-4, --ns-success, --ns-text-lg, --ns-text-small, --ns-text-xs, --ns-tracking-kpi-sm, --ns-tracking-small, --ns-warning, --ns-weight-kpi-sm, --ns-weight-small.

Contract and compatibility

Accessibility pattern: noninteractive presentation

  • Native DOM attributes pass through where the implementation accepts them.
  • data-series is emitted only for automatic palette entries; explicit tone keeps semantic intent.

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.