Select an option, including a mixed selection state.
import { useState } from 'react';
import { Checkbox } from '@vrum/ui';
export default function Demo() {
const [checked, setChecked] = useState(false);
return (
<Checkbox
checked={checked}
label={"Include archived projects"}
disabled={false}
onCheckedChange={setChecked}
/>
);
}Copy code| Prop | Type | Default | Description |
|---|---|---|---|
checked | boolean | "indeterminate" | none | Controlled selection state. |
onCheckedChange | ((checked: boolean) => void) | none | Called when the selection changes. |
label | React.ReactNode | none | Visible or accessible label. |
disabled | boolean | none | Disable user interaction. |
name | string | none | name configuration. |
type | HTMLInputTypeAttribute | none | type configuration. |
value | string | number | readonly string[] | none | Controlled value. |
defaultChecked | boolean | none | default checked configuration. |
defaultValue | string | number | readonly string[] | none | Initial value for an uncontrolled component. |
autoFocus | boolean | none | auto focus configuration. |
className | string | none | Additional CSS classes. |
id | string | none | id configuration. |
style | CSSProperties | none | Inline style overrides. |
aria-invalid | boolean | "false" | "true" | "grammar" | "spelling" | none | Indicates the entered value does not conform to the format expected by the application. |
aria-label | string | none | Defines a string value that labels the current element. |
children | ReactNode | none | Content rendered inside the component. |
onFocus | FocusEventHandler<HTMLInputElement> | none | on focus configuration. |
onBlur | FocusEventHandler<HTMLInputElement> | none | on blur configuration. |
onChange | ChangeEventHandler<HTMLInputElement, HTMLInputElement> | none | Called when the input value changes. |
onSubmit | SubmitEventHandler<HTMLInputElement> | none | Called when the form is submitted. |
onKeyDown | KeyboardEventHandler<HTMLInputElement> | none | on key down configuration. |
onClick | MouseEventHandler<HTMLInputElement> | none | Called when the control is activated. |
onSelect | ReactEventHandler<HTMLInputElement> | none | on select configuration. |
maxLength | number | none | max length configuration. |
placeholder | string | none | Hint shown when the field is empty. |
readOnly | boolean | none | read only configuration. |
required | boolean | none | required configuration. |