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
size
Required
false
Type
"sm" | "md" | "lg"
Default
"md"
invalid
Required
false
Type
"sm" | "md" | "lg"
Default
"md"
...rest
Required
false
Type
Omit<ComponentProps<"input">, "size">
Default
none
Notes
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:<input
type="radio"
class={className}
{...restWithoutClass}
/>