Search documentation

Search the documentation and open a page.

A set of checkable buttons where only one option can be selected at a time.

Loading...

Installation

pnpm dlx shadcn@latest add @wirekyt/radio-group

Composition

<app-radio-group> ├── [appRadioGroupLabel] (optional) └── <label appRadioGroupItem> ├── [appRadioGroupItemControl] │ └── generated indicator icon ├── [appRadioGroupItemText] └── <input appRadioGroupItemHiddenInput>

Examples

Default

Loading...

Grid

Loading...

Invalid

Loading...

List

Loading...

API Reference

<app-radio-group>

Inputs

InputTypeDefaultDescription
idstring | undefinedgeneratedUnique identifier used to create the radio-group part IDs.
idsRadioGroupElementIds | undefined—Overrides the generated IDs for individual parts.
valuestring | null | undefined—Selected value when controlled. Supports Angular two-way binding.
defaultValuestring | null | undefined—Initial selected value when uncontrolled.
namestring | undefined—Name used when submitting the selected value with a form.
formstring | undefined—Associates the radio group with a form by ID.
disabledbooleanfalseDisables interaction with the radio group.
invalidbooleanfalseMarks the radio group as invalid.
requiredbooleanfalseMarks the radio group as required.
readOnlybooleanfalsePrevents changes while preserving focus and navigation.
orientationRadioGroupOrientation | undefined"horizontal"Sets the component orientation and keyboard navigation axis.

Outputs

OutputTypeDescription
valueChangestring | null | undefinedEmits the current selected value.
valueDetailsChangeRadioGroupValueChangeDetailsEmits details whenever the selected value changes.

<label appRadioGroupItem>

Inputs

InputTypeDefaultDescription
valuestringrequiredValue represented by this radio-group item.
disabledbooleanfalseDisables interaction with this item.
invalidbooleanfalseMarks this item as invalid.

Context, Providers, and Utilities

ExportAngular API
RadioGroupRootProviderDirective that provides an externally created radio-group API through value.
RadioGroupContextStructural directive [radio-group-context] exposing the root API to a template.
RadioGroupItemContextDirectiveStructural directive [radio-group-item-context] exposing item state.
useRadioGroup(options)Creates the signal-backed radio-group machine inside an injection context.
injectRadioGroupContext()Injects the nearest radio-group root context.
injectRadioGroupItemContext()Injects the nearest radio-group item state.
injectRadioGroupItemPropsContext()Injects the nearest radio-group item props.
RadioGroupImportsReadonly collection containing the radio-group UI and context helpers.

Types

ExportDescription
RadioGroupApiConnected radio-group state and actions.
RadioGroupElementIdsOverrides for generated radio-group part IDs.
RadioGroupItemPropsProps used to derive the state of a radio-group item.
RadioGroupItemStateDerived state for a radio-group item.
RadioGroupOrientationKeyboard navigation axis: "horizontal" or "vertical".
RadioGroupValueChangeDetailsDetails emitted by valueDetailsChange.
UseRadioGroupOptionsOptions accepted by useRadioGroup.
UseRadioGroupPropsRoot props accepted by the radio-group machine.
UseRadioGroupReturnSignal-backed radio-group machine returned by useRadioGroup.