Flutter docs
Default skin

Radio

Used to select a single state from multiple options.

When to use

  • Used to select a single state from multiple options.
  • The difference from Select is that Radio is visible to the user and can facilitate the comparison of choice, which means there shouldn't be too many of them.

Examples

Basic

The simplest use.

Radio Group

A group of radio components.

Block Radio.Group

The block property will make a Radio.Group fit to its parent width.

radio style

The combination of radio button style.

Size

There are three sizes available: large, medium, and small. It can coordinate with input box.

Custom semantic dom styling

You can customize the semantic dom style of radio by passing objects/functions through classNames and styles.

disabled

Radio unavailable.

Vertical Radio.Group

Vertical Radio.Group, with more radios.

Radio.Group group - optional

Render radios by configuring options. Radio type can also be set through the optionType parameter.

Radio.Group with name

Passing the name property to all input[type="radio"] that are in the same Radio.Group. It is usually used to let the browser see your Radio.Group as a real "group" and keep the default behavior.

Solid radio button

Solid radio button style.

API

Radio, Radio.Group, and Radio.Button are exported from @ceebee/ui/client.

Radio/Radio.Button

PropertyDescriptionTypeDefaultVersion
checkedSpecifies whether the radio is selectedbooleanfalse—
classNamesCustomize class for each semantic structure inside the component. Supports object or function.Record<SemanticDOM, string> | (info: { props })=> Record<SemanticDOM, string>-6.0.0
defaultCheckedSpecifies the initial state: whether or not the radio is selectedbooleanfalse—
disabledDisable radiobooleanfalse—
stylesCustomize inline style for each semantic structure inside the component. Supports object or function.Record<SemanticDOM, CSSProperties> | (info: { props })=> Record<SemanticDOM, CSSProperties>-6.0.0
valueAccording to value for comparison, to determine whether the selectedany-—

Radio.Group

PropertyDescriptionTypeDefaultVersion
blockOption to fit RadioGroup width to its parent widthbooleanfalse5.21.0
buttonStyleThe style type of radio buttonoutline | solidoutline—
classNamesCustomize class for each semantic structure inside the component. Supports object or function.Record<SemanticDOM, string> | (info: { props })=> Record<SemanticDOM, string>-6.0.0
defaultValueDefault selected valueany-—
disabledDisable all radio buttonsbooleanfalse—
nameThe name property of all input[type="radio"] children. If not set, it will fallback to a randomly generated namestring-—
optionsSet children optionalstring\[] | number\[] | Array&lt;CheckboxOptionType>-—
optionTypeSet Radio optionTypedefault | buttondefault4.4.0
orientationOrientationhorizontal | verticalhorizontal—
sizeThe size of radio button stylelarge | medium | small-—
stylesCustomize inline style for each semantic structure inside the component. Supports object or function.Record<SemanticDOM, CSSProperties> | (info: { props })=> Record<SemanticDOM, CSSProperties>-6.0.0
valueUsed for setting the currently selected valueany-—
verticalIf true, the Radio group will be vertical. Simultaneously existing with orientation, orientation takes prioritybooleanfalse—
onChangeThe callback function that is triggered when the state changesfunction(e:Event)-—

CheckboxOptionType

PropertyDescriptionTypeDefaultVersion
labelThe text used to display as the Radio optionstring-4.4.0
valueThe value associated with the Radio optionstring | number | boolean-4.4.0
styleThe style to apply to the Radio optionReact.CSSProperties-4.4.0
classNameclassName of the Radio optionstring-5.25.0
disabledSpecifies whether the Radio option is disabledbooleanfalse4.4.0
titleAdds the Title attribute valuestring-4.4.0
idAdds the Radio Id attribute valuestring-4.4.0
onChangeTriggered when the value of the Radio Group changes(e: CheckboxChangeEvent) => void;-4.4.0
requiredSpecifies whether the Radio option is requiredbooleanfalse4.4.0

Radio

PropertyDescriptionTypeDefaultVersion
blur()Remove focus———
focus()Get focus———