Skip to main content

Radio

Radio.

When To Use#

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

Examples#

import { Radio, RadioGroup } from 'tailor-ui';

Radio#

Basic#


Use with FormField#

this is a required field

Disabled#


RadioGroup#

Basic#


Controlled#


Composition render#


Direction#

Use with FormField#

Should press yes

API#

Radio#

PropertyDescriptionTypeDefault
checkedSpecifies whether the Radio is selectedboolean
defaultCheckedSpecifies the initial state: whether or not the Radio is selectedboolean
disabledDisable Radiobooleanfalse
onChangeThe callback function that is triggered when the state changes(event: ChangeEvent) => void
valueThe value of radiostring
idThe id of radiostring
onFocus(event: FocusEvent) => void
onBlur(event: FocusEvent) => void

RadioGroup#

PropertyDescriptionTypeDefault
directionto specify the direction of the step bar'horizontal' 'vertical'
defaultValueTo set the initial valuestring[]
optionsSpecifies options{ label: ReactNode; value: string; disabled?: boolean; }[]
valueUsed for setting the currently selected valuestring[]
onChangeThe callback function that is triggered when the state changes(value: string[]) => void