# Checkbox

> An accessible checkbox with label, description, error, and indeterminate state.

- Tier: free, MIT
- Category: Forms
- Docs: https://ui.mlola.com/docs/components/checkbox

## Install

```bash
npx mlola-ui add checkbox
```

```tsx
import { Checkbox } from "@/components/ui/checkbox";
```

## Example

```tsx
import { Checkbox } from "@/components/ui/checkbox";

export default function Example() {
  return <Checkbox label="Email me about releases" description="At most once a month." defaultChecked />;
}
```

## The same markup without React

```html
<div class="ml-checkbox-field" data-state="checked">
  <label class="ml-checkbox-control" data-hit="expand"><input class="ml-checkbox-input" id="checkbox-1" type="checkbox" aria-checked="true" aria-describedby="checkbox-1-description" checked=""/><span class="ml-checkbox-indicator" aria-hidden="true"><svg class="mlola-glyph" width="0.75em" height="0.75em" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="var(--mlola-glyph-stroke, var(--ml-icon-stroke, 1.75))" stroke-linecap="round" stroke-linejoin="round" focusable="false" aria-hidden="true" data-optical-size="default" style="color:var(--mlola-glyph-color, currentColor);scale:var(--mlola-glyph-optical-scale, 1);transform-origin:center"><polyline points="20 6 9 17 4 12" pathLength="1"></polyline></svg></span></label>
  <span class="ml-checkbox-copy"><label class="ml-checkbox-label" for="checkbox-1"><span class="ml-checkbox-text">Email me about releases</span></label><span class="ml-checkbox-description" id="checkbox-1-description">At most once a month.</span></span>
</div>
```
