Basic
<Checkbox />
Controlled
See Controlled & Uncontrolled Components and Checkbox Example. Passing
checked
and onClick
work because of ...rest
.<Checkbox checked={checked} onClick={onClick} />
Size
Set
size
to "sm"
, "md"
, or "lg"
. Defaults to "md"
.<Stack class="gap-5">
<Checkbox size="sm" />
<Checkbox size="md" />
<Checkbox size="lg" />
</Stack>
Disabled
Set
disabled
to either true
or false
. Defaults to false
.<Checkbox disabled />
Invalid
Set
invalid
to either true
or false
. Defaults to false
.<Checkbox 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
Checkbox
, you could pass anything you normally would pass to <input type="checkbox" />
because the return value looks something like this:<input
type="checkbox"
class={className}
{...rest}
/>