React

Radio Group

A component used to allow selecting one option among multiple options.

Available since@seed-design/react@0.2.3, @seed-design/css@0.2.3

Installation

npx @seed-design/cli@latest add ui:radio-group

Props

RadioGroup

Prop

Type

label?React.ReactNode
indicator?React.ReactNode
showRequiredIndicator?boolean | undefined
description?React.ReactNode
errorMessage?React.ReactNode
name?string | undefined
form?string | undefined
value?string | undefined
defaultValue?string | undefined
onValueChange?((value: string) => void) | undefined

RadioGroupItem

Prop

Type

label?React.ReactNode
inputProps?React.InputHTMLAttributes<HTMLInputElement> | undefined
rootRef?React.Ref<HTMLLabelElement> | undefined
valuestring
disabled?boolean | undefined

Radiomark

Prop

Type

Examples

Sizes

Tones

Brand

Neutral

Weights

Long Label

Disabled

Listening to Value Changes

You can detect changes to the selected value of the radio buttons using RadioGroup's onValueChange.

If you need to use events, you can add event handlers directly to the internal <input> element via RadioGroupItem's inputProps.

Use Cases

React Hook Form

Using Radiomark

Radiomark is an independent radio mark component that can be combined with Radio Group Primitive components for custom layouts.

RadioGroupField Integration

You can use RadioGroupField-related props such as label, description, and errorMessage.

Scale Feedback

RadioGroupItem provides feedback where Radiomark shrinks slightly when pressed.

If you apply Scale Feedback directly to the element wrapping Radiomark, the outer element and Radiomark shrink together, causing the shrinking to appear doubled. Setting --seed-radiomark-feedback-scale to 1 on a parent element of Radiomark allows you to disable only Radiomark's shrinking. Since this variable is inherited, you can set it on an element wrapping the entire RadioGroupItem.

MyRow.css
.my-row {
  --seed-radiomark-feedback-scale: 1;
}

Table of contents