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

RadioGroup

Native radio fieldset with option labels and descriptions.

All components · Theme builder · Implementation source

Live preview

Open live radio-group preview

Install

Shell
netscript ui:add radio-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 { RadioGroup } from '@app/components/ui/radio-group.tsx';

export function Example() {
  const [value, setValue] = useState('standard');
  const [open, setOpen] = useState(false);
  const [notice, report] = useState('');
  return (<><div><RadioGroup name="shipping" legend="Shipping method" options={[{value:"standard",label:"Standard"},{value:"express",label:"Express"}]} /></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
RadioGroupPropsnamestringNo
RadioGroupPropslegendComponentChildrenNo
RadioGroupPropsoptions[object Object]No
RadioGroupPropsvaluestringYes
RadioGroupPropsdefaultValuestringYes
RadioGroupPropsonValueChange(value: string) => voidYes
RadioGroupPropsorientation"horizontal" | "vertical"Yes
RadioGroupPropsstate"rest" | "hover" | "focus" | "disabled" | "invalid"Yes
RadioGroupPropsdisabledbooleanYes
RadioGroupPropsrequiredbooleanYes
RadioGroupPropsclassstringYes
TypeScript
RadioGroupProps extends Omit<JSX.HTMLAttributes<HTMLFieldSetElement>, "class" | "onChange">

Keyboard

KeyAction
Arrow keysMove focus and selection
SpaceSelect focused radio

Tokens

Semantic contract roles: border/input, primary/default, size/checkbox, space/stack/gap, surface/card.

CSS custom properties referenced directly: --ns-border-width, --ns-card, --ns-control-gap, --ns-destructive, --ns-fg, --ns-input-border, --ns-muted-fg, --ns-primary, --ns-ring, --ns-space-1, --ns-space-2, --ns-space-4, --ns-text-small, --ns-text-strong, --ns-weight-strong.

Contract and compatibility

Accessibility pattern: WAI-ARIA guidance

  • Native controls own keyboard/form behavior. Transient focus/hover is CSS/native; data-state also supports deliberate preview. Client visual/controlled updates require an island.
  • Design checked belongs to individual Radio controls; the group public API uses value/defaultValue and native name. Disabled fieldset applies to every option.

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.