# Checkbox

The native checkbox with a styled box, a check icon and an indeterminate state.

## Binding and callback

`bind:checked` keeps a state in step with the box; `onCheckedChange` runs on every change. Both compose: the component renders a real `<input type="checkbox">`, so it also takes part in plain `FormData` submissions via `name`.

## States

Checked, indeterminate for a partly checked group, and disabled.

## Examples

```svelte
<script lang="ts">
  import Checkbox from '@qualia-studios/design-ui/components/Checkbox.svelte';

  let checked = $state(false);
  let callbackCount = $state(0);
</script>
```

### Example 1: A bound checkbox

```svelte
<label class="row">
  <Checkbox bind:checked />
  <span>Currently {checked ? 'checked' : 'unchecked'}</span>
</label>
```

### Example 2: A change callback, counted

```svelte
<label class="row">
  <Checkbox onCheckedChange={() => callbackCount++} />
  <span>Changed {callbackCount} times</span>
</label>
```

### Example 3: Checked, indeterminate and disabled

```svelte
<Checkbox checked />
<Checkbox indeterminate />
<Checkbox disabled />
```

---

From the Qualia design guide: https://q-core-3b2732.gitlab.io/components/checkbox. Every page as markdown: https://q-core-3b2732.gitlab.io/llms.txt
