form fields
<tc-radio-group>
Mutually exclusive choices rendered from an options array. Form-associated and keyboard-navigable.
import
"@ra9/tan-compose-kit/radio-group"
Props
| Name | Type | Default | Description |
|---|---|---|---|
value | string | "" | Currently-selected option value. |
name | string | "" | Field name for form submission. Shared across the radio set. |
options | Array<{ value: string; label: string; disabled?: boolean }> | [] | Options to render. JSON attribute or JS property. |
label | string | "" | Group label rendered as a `<legend>`. |
helper | string | "" | Small helper text below the group. |
error | string | "" | Error message; the radiogroup gets `aria-invalid="true"`. |
layout | "vertical" | "horizontal" | "vertical" | Stack the options vertically or wrap them horizontally. |
disabled | boolean | false | Disables every radio at once. Reflects to the host. |
required | boolean | false | Required for form validation. Reflects to the host. |
Events
| Event | Detail | When |
|---|---|---|
tc-change | { value: string } | Fires when the user selects a new option. |
CSS variables
| Variable | Default | Description |
|---|---|---|
--tc-input-fg | var(--tc-color-ink, #14171f) | Legend + label color. |
--tc-input-border | var(--tc-color-rule-strong, #d9cfb8) | Radio circle border (via native `accent-color`). |
--tc-input-error | var(--tc-color-danger, #b3261e) | Error message color. |
--tc-input-helper | var(--tc-color-ink-muted, #6b7280) | Helper text color. |
--tc-input-font | var(--tc-font-sans, …) | Font family. |
--tc-radio-accent | var(--tc-color-accent, #a16939) | `accent-color` of the selected radio. |
Examples
Basic usage
Horizontal layout
Disabled options
Error state
In a form
Theming
Accessibility
- Renders a real
<fieldset>+<legend>so the group label is announced before each option. - The container has
role="radiogroup"andaria-invalidreflects the error state. - Each option is a real
<input type="radio">— full native keyboard support (arrows move between options, Tab moves out of the group). - Disabled options can't be focused or selected.