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

ToggleGroup

Single/multiple pressed-button toolbar with roving arrow navigation.

All components · Theme builder · Implementation source

Live preview

Open live toggle-group preview

Install

Shell
netscript ui:add toggle-group

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

export function Example() {
  const [value, setValue] = useState('standard');
  const [open, setOpen] = useState(false);
  const [notice, report] = useState('');
  return (<><div><ToggleGroup label="Order view" items={[{value:"list",label:"List"},{value:"grid",label:"Grid"}]} /></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
ToggleGroupPropsclassstringYes
ToggleGroupPropslabelstringNo
ToggleGroupPropsitems[object Object]No
ToggleGroupPropstype"single" | "multiple"Yes
ToggleGroupPropsvariant"default" | "outline" | "segmented"Yes
ToggleGroupPropsorientation"horizontal" | "vertical"Yes
ToggleGroupPropssize"sm" | "md"Yes
ToggleGroupPropsvalue[object Object]Yes
ToggleGroupPropsdefaultValue[object Object]Yes
ToggleGroupPropsonValueChange(value: [object Object]) => voidYes
ToggleGroupPropsdisabledbooleanYes
TypeScript
ToggleGroupProps extends Omit<JSX.HTMLAttributes<HTMLDivElement>, "class">

Keyboard

KeyAction
Arrow keysMove focus between toggles
Home/EndFocus first/last toggle
Enter/SpaceToggle focused item

Tokens

Semantic contract roles: space/inline/gap.

CSS custom properties referenced directly: --ns-component-tabs-selected, --ns-control-gap, --ns-fg, --ns-muted, --ns-radius-control, --ns-space-1, --ns-space-1-5, --ns-studio-signal-marker, --ns-studio-tabs-gap, --ns-studio-tabs-pad, --ns-studio-tabs-radius, --ns-studio-tabs-sel-bg, --ns-studio-tabs-track.

Contract and compatibility

Accessibility pattern: WAI-ARIA guidance

  • Native CSS pseudo-classes carry transient focus/hover; data-state also supports deliberate preview renders. Native button semantics preserve form behavior.

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.