Navigated to /docs/ui/components/checkbox

Checkbox

Token-styled checkbox control with indeterminate support.

Preview

A live, theme-aware example rendered with the published component.

Loading preview…

Import

Import the component from its dedicated entry point to keep the dependency and generated bundle explicit.

TSX
tsximport { Checkbox } from "@tavojs/ui/checkbox";

Normal Tavo.js applications load component styles through the Tavo.js UI plugin. If the application manages component CSS manually, also import @tavojs/ui/css/checkbox.

When to use

Use it when

Use `Checkbox` for binary choices

Choose something else when

Avoid Checkbox when wrapping controls without labels or accessible names.

Examples

Checkbox example

TSX
tsximport { Checkbox } from "@tavojs/ui/checkbox";

export function CheckboxExample1() {
  return (
    <>
      <Checkbox checked aria-label="Enable notifications" />
    </>
  );
}

Common props and defaults

PropTypeDefaultDescription
classNamestring

Optional class hook applied to the public root element owned by the component.
checkedboolean

Configures checked for this component.
defaultCheckedboolean

Configures defaultChecked for this component.
indeterminateboolean

Configures indeterminate for this component.
disabledboolean

Configures disabled for this component.
sizeSize

Configures size for this component.
tone"primary" | "secondary" | "neutral"

Configures tone for this component.

Complete TypeScript API

Import from @tavojs/ui/checkbox. Published exports: Checkbox, CheckboxProps.

CheckboxProps

PropertyTypeRequiredDescription
childrenChild

No

Inherited children attribute accepted by Checkbox.

classNamestring

No

Optional class hook applied to the public root element owned by the component.

sxSx

No

Inherited sx attribute accepted by Checkbox.

idstring

No

Inherited id attribute accepted by Checkbox.

rolestring

No

Inherited role attribute accepted by Checkbox.

styleRecord<string, unknown>

No

Inherited style attribute accepted by Checkbox.

titlestring

No

Inherited title attribute accepted by Checkbox.

tabIndexnumber

No

Inherited tabIndex attribute accepted by Checkbox.

hiddenboolean

No

Inherited hidden attribute accepted by Checkbox.

disabledboolean

No

Configures disabled for this component.

onClickTavoEventHandler<MouseEvent>

No

Inherited onClick attribute accepted by Checkbox.

onChangeTavoEventHandler<Event>

No

Inherited onChange attribute accepted by Checkbox.

onInputTavoEventHandler<Event>

No

Inherited onInput attribute accepted by Checkbox.

onKeyDownTavoEventHandler<KeyboardEvent>

No

Inherited onKeyDown attribute accepted by Checkbox.

onFocusTavoEventHandler<FocusEvent>

No

Inherited onFocus attribute accepted by Checkbox.

onBlurTavoEventHandler<FocusEvent>

No

Inherited onBlur attribute accepted by Checkbox.

checkedboolean

No

Configures checked for this component.

defaultCheckedboolean

No

Configures defaultChecked for this component.

indeterminateboolean

No

Configures indeterminate for this component.

sizeSize

No

Configures size for this component.

tone"neutral" | "primary" | "secondary"

No

Configures tone for this component.

State ownership and DOM target

ConcernContract
StateApplication controlled through checked and the matching callback.
DOM targetNative input attributes target the owned form control; wrapper-specific props stay on the documented component root.

Anatomy and related components

This component exposes one public component root rather than a compound member API.

Limitations

Avoid Checkbox when wrapping controls without labels or accessible names.

Use only the documented props, entry points, and compound members. Internal DOM nesting and CSS class names can change without becoming part of the public component contract.

Accessibility

Use with `FormControlLabel` or provide `aria-label`.

  • Use with `FormControlLabel` or provide `aria-label`.

Component status

ContractCurrent value
Maturitystable
Categoryforms
Component import@tavojs/ui/checkbox
Explicit CSS import@tavojs/ui/css/checkbox
PreviewInteractive preview available on this page