<RadioGroup><Radio value="change" size="md" isInvalid={false} isDisabled={false}><RadioIndicator mr="$2"><RadioIcon as={CircleIcon} strokeWidth={1} /></RadioIndicator><RadioLabel>Label</RadioLabel></Radio></RadioGroup>
import { Radio } from '@gluestack-ui/themed';
export default () => (<RadioGroup><Radio><RadioIndicator><RadioIcon /></RadioIndicator><RadioLabel /></Radio></RadioGroup>)
Prop | Type | Default | Description |
---|---|---|---|
value | string | - | The value to be used in the radio input. This is the value that will be returned on form submission. |
onChange | function | - | Function called when the state of the radio changes. |
isDisabled | bool | false | To manually set disable to the radio. |
isInvalid | bool | false | To manually set invalid to the radio. |
isHovered | bool | false | To manually set hover to the radio. |
isFocusVisible | bool | false | To manually set focus visible state to the radio. |
isIndeterminate | bool | false | To manually set indeterminate to the radio. |
Sx Prop | Description |
---|---|
_text | Prop to style RadioLabel Component |
_icon | Prop to style RadioIcon Component |
_indicator | Prop to style RadioIndicator Component |
Prop | Type | Default | Description |
---|---|---|---|
value | string | - | The value of the radio group. |
onChange | function | - | The callback fired when any children Radio is checked or
unchecked. |
isReadOnly | bool | false | To manually set read-only to the radio group. |
Sx Prop | Description |
---|---|
_radio | Prop to style Radio Component |
Name | Value | Default |
---|---|---|
size | lg | md | sm | md |
function App() {const [values, setValues] = React.useState("Eng")return (<RadioGroup value={values} onChange={setValues}><VStack space="sm"><Radio value="Eng"><RadioIndicator mr="$2"><RadioIcon as={CircleIcon} /></RadioIndicator><RadioLabel>English</RadioLabel></Radio><Radio value="Fre"><RadioIndicator mr="$2"><RadioIcon as={CircleIcon} /></RadioIndicator><RadioLabel>French</RadioLabel></Radio><Radio value="Ger"><RadioIndicator mr="$2"><RadioIcon as={CircleIcon} /></RadioIndicator><RadioLabel>German</RadioLabel></Radio></VStack></RadioGroup>)}
function App() {const [values, setValues] = React.useState("Cash On Delivery")return (<RadioGroup value={values} onChange={setValues}><HStack space="2xl"><Radio value="Credit Card"><RadioIndicator mr="$2"><RadioIcon as={CircleIcon} /></RadioIndicator><RadioLabel>Credit Card</RadioLabel></Radio><Radio value="Cash On Delivery"><RadioIndicator mr="$2"><RadioIcon as={CircleIcon} /></RadioIndicator><RadioLabel>Cash On Delivery</RadioLabel></Radio></HStack></RadioGroup>)}
function App() {const [values, setValues] = React.useState("Read-only")return (<RadioGroup value={values} onChange={setValues}><VStack space="2xl"><Box><Radio value="Read-only" size="md"><RadioIndicator mr="$2"><RadioIcon as={CircleIcon} /></RadioIndicator><RadioLabel>Extended coverage</RadioLabel></Radio><Text size="$sm" ml="$7" color="$textLight500">Extra services included</Text></Box><Box><Radio value="Write" size="md"><RadioIndicator mr="$2"><RadioIcon as={CircleIcon} /></RadioIndicator><RadioLabel>Basic coverage</RadioLabel></Radio><Text size="$sm" ml="$7" color="$textLight500">Nothing extra included</Text></Box></VStack></RadioGroup>)}
<FormControl><VStack space="md"><Heading size="sm">Which time slot works best for you?</Heading><RadioGroup><VStack space="sm"><Radio value="Monday" size="md"><RadioIndicator mr="$2"><RadioIcon as={CircleIcon} /></RadioIndicator><RadioLabel>Monday</RadioLabel></Radio><Radio value="Tuesday" size="md"><RadioIndicator mr="$2"><RadioIcon as={CircleIcon} /></RadioIndicator><RadioLabel>Tuesday</RadioLabel></Radio><Radio value="Wednesday" size="md"><RadioIndicator mr="$2"><RadioIcon as={CircleIcon} /></RadioIndicator><RadioLabel>Wednesday</RadioLabel></Radio></VStack></RadioGroup><Text fontSize="$sm" color="$textLight500">Choose a time slot for the meeting</Text></VStack></FormControl>
function App() {const [values, setValues] = useState("Monday")return (<RadioGroup value={values} onChange={setValues}><VStack space="lg" w="$40"><Radio value="Monday" justifyContent="space-between"><RadioLabel>Jane Cooper</RadioLabel><RadioIndicator><RadioIcon as={CircleIcon} /></RadioIndicator></Radio><Radio value="Tuesday" justifyContent="space-between"><RadioLabel>Wade Warren</RadioLabel><RadioIndicator><RadioIcon as={CircleIcon} /></RadioIndicator></Radio></VStack></RadioGroup>)}
function App() {const [values, setValues] = useState("Apartments")return (<RadioGroup value={values} onChange={setValues}><VStack space="md"><Radio value="Apartments"><RadioIndicator mr="$2"><RadioIcon as={CircleIcon} /></RadioIndicator><RadioLabel>Apartments</RadioLabel></Radio><Radio value="Houses"><RadioIndicator mr="$2"><RadioIcon as={CircleIcon} /></RadioIndicator><RadioLabel>Houses</RadioLabel></Radio></VStack></RadioGroup>)}
function App() {const radioRef = useRef(null)const handleRadioChange = (e) => {e.preventDefault()const checkboxValue = radioRef.current.checked}return (<RadioGroup><VStack space="md"><Radio value="Hotels" ref={radioRef} onChange={handleRadioChange}><RadioIndicator mr="$2"><RadioIcon as={CircleIcon} /></RadioIndicator><RadioLabel>Hotels</RadioLabel></Radio><Radiovalue="Living quarters"ref={radioRef}onChange={handleRadioChange}><RadioIndicator mr="$2"><RadioIcon as={CircleIcon} /></RadioIndicator><RadioLabel>Living quarters</RadioLabel></Radio></VStack></RadioGroup>)}
function RadioGroupExample() {const [values, setValues] = useState("1st")return (<RadioGroup value={values} onChange={setValues}><VStack space="sm"><Radio value="1st"><RadioIndicator mr="$2"><RadioIcon as={CircleIcon} /></RadioIndicator><RadioLabel>Label 1</RadioLabel></Radio><Radio value="2nd"><RadioIndicator mr="$2"><RadioIcon as={CircleIcon} /></RadioIndicator><RadioLabel>Label 2</RadioLabel></Radio><Radio value="3rd"><RadioIndicator mr="$2"><RadioIcon as={CircleIcon} /></RadioIndicator><RadioLabel>Label 3</RadioLabel></Radio></VStack></RadioGroup>)}