Checkbox
A control that allows the user to toggle between checked and not checked.
Examples
Basic
| Prop | Default | Type | Description |
|---|---|---|---|
modelValue | - | boolean, indeterminate | The controlled checked state of the checkbox. Can be binded with v-model. |
defaultValue | - | boolean | The checked state of the checkbox when it is initially rendered. Use when you do not need to control its checked state. |
disabled | - | boolean | When true, prevents the user from interacting with the checkbox. |
id | randomId() | string | Id of the element. |
name | - | string | The name of the checkbox. Submitted with its owning form as part of a name/value pair. |
required | - | boolean | When true, indicates that the user must check the checkbox before the owning form can be submitted. |
value | on | string | The value given as data when submitted with a name. |
label | - | string | Set the label of the checkbox. |
Read more in Reka Checkbox Root API.
Color
| Prop | Default | Type | Description |
|---|---|---|---|
color | primary | string | Change the color of the checkbox. |
Form Group
You can use the checkbox component inside the form-group component, or you can use it with the label component.
Notifications for the conversations you are participating in, or if someone cites you with an @mention. Also for all activity when subscribed to specific events.
Notifications for the conversations you are participating in, or if someone cites you with an @mention. Also for all activity when subscribed to specific events.
You must choose at least one event
Read more in Form-group component
Read more in Label component
Size
Adjust the select size without limits. Use breakpoints (e.g., sm:sm, xs:lg) for responsive sizes or states (e.g., hover:lg, focus:3xl) for state-based sizes.
| Prop | Default | Type | Description |
|---|---|---|---|
size | md | string | Adjust the size of the checkbox. |
You can also utilize data-[state] to dynamically modify the size of the checkbox based on its state.
| Data state | Description |
|---|---|
data-[state=checked] | Only apply the class if the checkbox is checked. |
data-[state=unchecked] | Only apply the class if the checkbox is unchecked. |
data-[state=indeterminate] | Only apply the class if the checkbox is indeterminate. |
Reverse
| Prop | Default | Type | Description |
|---|---|---|---|
reverse | - | boolean | Reverse the position of the checkbox and label. |
Customization
You can customize the checkbox using the
unaprop and utility classes.
| Prop | Default | Type | Description |
|---|---|---|---|
una.checkboxCheckedIcon | i-check | string | Custom icon of the checkbox when it is checked. |
una.checkboxUncheckedIcon | null | string | Custom icon of the checkbox when it is unchecked. |
una.checkboxIndeterminateIcon | i-lucide-minus | string | Custom icon of the checkbox when it is indeterminate. |
Value: [
true,
true,
true,
true
]
Slots
| Name | Description |
|---|---|
default | Use this slot to customize the label of the checkbox. |
icon | Use this slot to customize the icon of the checkbox when it is checked |
Presets
shortcuts/checkbox.ts
Props
types/checkbox.ts