RadioButton
This component is basically just a wrapper for
<input type="radio" />
. You'll probably want to use it along with a <label>
. You also might prefer to use RFUI's FormField
component instead.Radio buttons are appropriate when you are allowing the user to choose between a few options. If there are many options to choose from, prefer the
Select
component.import { RadioButton } from "rfui";
Basic
<RadioButton />
Controlled
See Controlled & Uncontrolled Components and Checkboxes & Radio Buttons. Passing
checked
and onClick
work because of ...rest
.<RadioButton checked={checked} onClick={onClick} />
Size
Set
size
to either "sm"
, "md"
or "lg"
. Defaults to "md"
.<Stack class="gap-5">
<RadioButton size="sm" />
<RadioButton size="md" />
<RadioButton size="lg" />
</Stack>
Disabled
Set
disabled
to either true
or false
. Defaults to false
.<RadioButton disabled />
Invalid
Set
invalid
to either true
or false
. Defaults to false
.<RadioButton invalid />
Props
Prop | Required | Default | Type and notes |
---|---|---|---|
size | - | "md" |
|
invalid | - | "md" |
|
...rest | - | - |
See the docs for rest parameters. For RadioButton , you could pass anything you normally would pass to <input type="radio"> because the return value looks something like this:
|