RadioGroup
Native radio fieldset with option labels and descriptions.
All components · Theme builder · Implementation source
Live preview
Install
netscript ui:add radio-groupUsage and examples
The preview runs this JSX with the installed components. Import any composed primitives from your UI directory.
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.
| Owner | Prop | Type | Optional | Description |
|---|---|---|---|---|
RadioGroupProps | name | string | No | |
RadioGroupProps | legend | ComponentChildren | No | |
RadioGroupProps | options | [object Object] | No | |
RadioGroupProps | value | string | Yes | |
RadioGroupProps | defaultValue | string | Yes | |
RadioGroupProps | onValueChange | (value: string) => void | Yes | |
RadioGroupProps | orientation | "horizontal" | "vertical" | Yes | |
RadioGroupProps | state | "rest" | "hover" | "focus" | "disabled" | "invalid" | Yes | |
RadioGroupProps | disabled | boolean | Yes | |
RadioGroupProps | required | boolean | Yes | |
RadioGroupProps | class | string | Yes |
RadioGroupProps extends Omit<JSX.HTMLAttributes<HTMLFieldSetElement>, "class" | "onChange">Keyboard
| Key | Action |
|---|---|
Arrow keys | Move focus and selection |
Space | Select 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.