Skip to main content

AdvancedRadio

A basic widget for getting the user input of radio with advanced design.

import { AdvancedRadio } from "rizzui";

Simple Advanced Radio

You can change style of AdvancedRadio.

import { AdvancedRadio } from "rizzui";

export default function App() {
return (
<div className="flex flex-wrap gap-6">
<AdvancedRadio name="age" value="any" alignment="center">
Any
</AdvancedRadio>
<AdvancedRadio name="age" value="one" defaultChecked alignment="center">
1
</AdvancedRadio>
<AdvancedRadio name="age" value="two" alignment="center">
2
</AdvancedRadio>
<AdvancedRadio name="age" value="three" disabled alignment="center">
3
</AdvancedRadio>
<AdvancedRadio name="age" value="four" alignment="center">
4
</AdvancedRadio>
<AdvancedRadio name="age" value="five+" alignment="center">
5+
</AdvancedRadio>
</div>
);
}

Currency Card Radio

You can give different style of AdvancedRadio as you need.

import { AdvancedRadio } from "rizzui";

export default function App() {
return (
<div className="grid grid-cols-1 sm:grid-cols-2 lg:grid-cols-4 gap-6">
<AdvancedRadio name="currency" value="taka" defaultChecked>
<CurrencyBangladeshiIcon className="w-7 h-auto mb-4" />
<Text className="font-semibold">Taka</Text>
</AdvancedRadio>
<AdvancedRadio name="currency" value="dollar">
<CurrencyDollarIcon className="w-7 h-auto mb-4" />
<Text className="font-semibold">Dollar</Text>
</AdvancedRadio>
<AdvancedRadio name="currency" value="euro">
<CurrencyEuroIcon className="w-7 h-auto mb-4" />
<Text className="font-semibold">Euro</Text>
</AdvancedRadio>
<AdvancedRadio name="currency" value="pound">
<CurrencyPoundIcon className="w-7 h-auto mb-4" />
<Text className="font-semibold">Pound</Text>
</AdvancedRadio>
</div>
);
}

API Reference


AdvancedRadio Props

Here is the API documentation of the AdvancedRadio component. And the rest of the props of AdvancedRadio are the same as the original html input field.

PropsTypeDescriptionDefault
childrenReactNodePass content as children__
disabledbooleanWhether the checkbox is disabled or not__
sizeRadioSizesThe size of the component.
"sm" is equivalent to the dense input styling.
"md"
roundedRadioRoundedThe rounded variants are:"md"
inputClassNamestringAdd inputClassName to style the input__
contentClassNamestringAdd contentClassName to style the input__
classNamestringAdd custom classes to the root of the component__
refRef<HTMLInputElement>__
...InputHTMLAttributesnative props like value, onChange, onFocus, onBlur ...__

Advanced Radio Sizes

type RadioSizes = "sm" | "md" | "lg" | "xl";

Advanced Radio Rounded

type RadioRounded = "sm" | "md" | "lg" | "pill" | "none";