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

NameTypeDefaultDetails
valuestringRequiredCurrently selected value.
itemsRadioItem[]RequiredArray of radio items with label and value.
onValueChange(value: string) => voidRequiredCallback when selection changes.
labelstringOptionalLabel for the radio group.
isDisabledbooleanfalseWhether the radio group is disabled.
classNamestring' 'You can customise container by passing tailwind classes.
labelClassNamestring' 'You can customise group label by passing tailwind classes.
itemClassNamestring' 'You can customise individual radio items by passing tailwind classes.