Skip to content

Forms

Radio

Bundle size
8.52 KB
3.0.2

A set of selectable buttons - where only one element can be selected at a time.

This component is an expansion of the Radio Group developed and maintained by Radix UI.

By default, it presents a smooth animation on selection toggle.

Terminal window
pnpm add @inpulse-ui/radio

Element that groups all radio buttons.

PropTypeDefault ValueRequired
asChildbooleanfalseNo
defaultValuestring-No
dir

enum

No
disabledboolean-No
loopbooleantrueNo
namestring-Yes
onChangefunction-No
orientation

enum

No
requiredboolean-No
valuestring-No
AttributeValue
[data-disabled]Present when disabled
[data-state]

An item, part of a group, that can be selected. An input will be rendered to ensure proper event propagation.

PropTypeDefault ValueRequired
asChildbooleanfalseNo
disabledbooleanfalseNo
idstring-No
monobooleanfalseNo
valuestring-No
AttributeValue
[data-disabled]Present when disabled
[data-state]

Instantiate the component within a form context and set an appropriate name attribute, otherwise it won’t be rendered. The name attribute must be unique within the form for proper functionality.

Set a value prop for each RadioItem to define its unique value.

import { Radio, RadioItem } from '@inpulse-ui/radio';
<Form {...useFormProps}>
<Radio name="field">
<RadioItem value="option-1">Option 1</RadioItem>
<RadioItem value="option-2">Option 2</RadioItem>
</Radio>
</Form>

You can set a default value to be selected when the component is rendered. To do this, simply set the defaultValue property in Radio.

You can disable a radio item individually by setting the disabled property to true directly on RadioItem.

Or disable the entire group of radio buttons by setting the disabled property to true in Radio.

By default, Radio will be assigned the theme’s primary color when enabled. But you can customize this color through CSS classes. The class must be applied directly to RadioItem. This way, you have the freedom to define different colors for each item.

Adopt a monochromatic style for Radio by setting the mono property to true. This style will adapt to the system’s light and dark mode. The property must be applied directly to RadioItem.

Use the onChange event to perform an action every time the value of the Radio is changed.

Project

Built with by Jo Santana in Brazil.

© 2026 Inpulse. All rights reserved.