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

Label

Accessible field label with required-state support.

All components · Theme builder · Implementation source

Live preview

Open live label preview

Install

Shell
netscript ui:add label

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

export function Example() {
  const [value, setValue] = useState('standard');
  const [open, setOpen] = useState(false);
  const [notice, report] = useState('');
  return (<><div><div><Label htmlFor="demo-label">Order name</Label><input id="demo-label" /></div></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
LabelPropschildrenRenderableNo
LabelPropsclassstringYes
LabelPropsrequiredbooleanYes
LabelPropsoptionalbooleanYes
LabelPropsoptionalTextRenderableYes
LabelPropsvariant"default" | "eyebrow"Yes
LabelPropsstate"rest" | "disabled" | "invalid"YesPresentation only; the associated input owns disabled/invalid semantics.
LabelPropsdata-partstringYes
LabelPropsdata-scopestringYes
LabelPropssrOnlybooleanYes
TypeScript
LabelProps extends Omit<JSX.LabelHTMLAttributes<HTMLLabelElement>, "class" | "children">

Keyboard

KeyAction
Tab/Shift+TabMove between associated controls; the label adds no focus target

Tokens

Semantic contract roles: destructive/text, text/fg, text/muted.

CSS custom properties referenced directly: --ns-destructive-text, --ns-fg, --ns-font-eyebrow, --ns-font-label, --ns-font-mono, --ns-font-sans, --ns-label-size, --ns-label-tracking, --ns-leading-caption, --ns-leading-label, --ns-leading-small, --ns-leading-strong, --ns-muted-fg, --ns-space-1, --ns-text-label, --ns-text-sm, --ns-text-small, --ns-text-strong, --ns-tracking-label, --ns-tracking-strong, --ns-type-label-strong-style, --ns-weight-eyebrow, --ns-weight-small, --ns-weight-strong.

Contract and compatibility

Accessibility pattern: native label

  • Native DOM attributes pass through where the implementation accepts them.
  • Required wins over optional. srOnly preserves the native accessible label and suppresses its decorative required mark.

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.