RadioA radio group component for selecting a single option from a list of options.
Install the component from your command line.
Radio buttons should always be accompanied by labels for accessibility and usability.
Radio buttons can be used in forms with proper validation and submission handling.
npm install @raystack/apsara
import { Radio } from '@raystack/apsara/v1' <Radio.Root defaultValue="1" aria-label="Options"> <Flex gap="small" align="center"> <Radio.Item value="1" id="r1" /> <label htmlFor="r1" style={{ fontSize: '14px', color: 'var(--rs-color-text-base-secondary)' }}>Option 1</label> <Radio.Item value="2" id="r2" /> <label htmlFor="r2" style={{ fontSize: '14px', color: 'var(--rs-color-text-base-secondary)' }}>Option 2</label> </Flex> </Radio.Root>
defaultValue
: The value of the radio item that should be checked by defaultvalue
: The controlled value of the radio item that is checkedonValueChange
: Event handler called when the value changesdisabled
: When true, prevents user interaction with the radio groupname
: The name of the radio group when submitted as a form fieldrequired
: When true, indicates that a value must be selected before the form can be submittedorientation
: The orientation of the radio group ("horizontal" | "vertical")dir
: The reading direction of the radio grouparia-label
: A label for the radio group that is announced by screen readers
value
: The unique value of the radio itemdisabled
: When true, prevents user interaction with this radio itemrequired
: When true, indicates that this radio item must be checkedid
: The unique identifier for the radio item
loading...
loading...
loading...