Radio Group
A Radio Group component allows users to select one option from a set of mutually exclusive choices. Built on top of heroui-native RadioGroup.
Demo
Demo Coming Soon
RadioGroup examples will be available soon.
Usage
import { useState } from 'react';import { NRadioGroup } from '@nayan-ui/react';const items = [{ value: 'startup', label: 'Startup' },{ value: 'business', label: 'Business' },{ value: 'enterprise', label: 'Enterprise' }];const RadioGroupExample = () => {const [selected, setSelected] = useState(items[0].value);return (<div><h1 className="text-foreground mb-3 text-base">Horizontal:</h1><NRadioGroup items={items} selected={selected} setSelected={setSelected} /><div className="mt-5" /><h1 className="text-foreground mb-3 text-base">Vertical:</h1><NRadioGroup orientation="vertical" items={items} selected={selected} setSelected={setSelected} /></div>);};export default RadioGroup;
Attributes
| Name | Type | Default | Details |
|---|---|---|---|
| value | string | Required | Currently selected value. |
| items | RadioItem[] | Required | Array of radio items with label and value. |
| onValueChange | (value: string) => void | Required | Callback when selection changes. |
| label | string | Optional | Label for the radio group. |
| isDisabled | boolean | false | Whether the radio group is disabled. |
| className | string | ' ' | You can customise container by passing tailwind classes. |
| labelClassName | string | ' ' | You can customise group label by passing tailwind classes. |
| itemClassName | string | ' ' | You can customise individual radio items by passing tailwind classes. |