Skip to main content
Mantı UI logoMantı UIv0.12.1
Studio

Checkbox

Use defaultChecked for uncontrolled state or checked with onCheckedChange for controlled state. indeterminate shows a mixed value.

import { Checkbox } from '@manti-ui/react';

export default function CheckboxBasic() {
  return (
    <div className="grid gap-3">
      <Checkbox defaultChecked={false}>Unchecked</Checkbox>
      <Checkbox defaultChecked>Checked</Checkbox>
      <Checkbox indeterminate>Indeterminate</Checkbox>
      <Checkbox defaultChecked={false} disabled>
        Disabled
      </Checkbox>
    </div>
  );
}

Sizes

API

PropTypeDefaultDescription
size'sm' | 'md' | 'lg''md'Control size.
variantMantiVariant'primary'Active variant when checked.
indeterminatebooleanfalseRender the mixed/indeterminate state.
childrenReactNodeOptional trailing label.
checkedbooleanControlled checked state.
defaultCheckedbooleanInitial checked state for uncontrolled usage.
onCheckedChange(checked: boolean) => voidCalled whenever the checked state changes.
disabledbooleanDisable the control.
invalidbooleanMark the control as invalid.
requiredbooleanRequire the control in a form.
readOnlybooleanMake the control read-only.
namestringForm field name.
valuestringForm field value when checked.

Styling

Anatomy

PartSelectorDescription
root[data-scope="checkbox"][data-part="root"]The label wrapping the control and text.
control[data-scope="checkbox"][data-part="control"]The square box that shows the check.
indicator[data-scope="checkbox"][data-part="indicator"]The drawn check or dash inside the box.
label[data-scope="checkbox"][data-part="label"]The trailing text label, when `children` is set.

Tokens

TokenControls
--manti-checkbox-sizesize
--manti-checkbox-radiusradius
--manti-checkbox-gapgap
--manti-checkbox-font-sizefont size
--manti-checkbox-indicator-sizeindicator size

Last updated

Built end-to-end with Manti UI components and design tokens. Manti UI is a framework-agnostic design system on Zag.js.

GitHub