# `ixfx-checkbox`

A custom checkbox with a diagonal line indicator and indeterminate state support. Uses shadow DOM with CSS variables for full appearance customization.

```html
<ixfx-checkbox label="Accept terms"></ixfx-checkbox>
<ixfx-checkbox checked label="Enabled"></ixfx-checkbox>
<ixfx-checkbox disabled label="Disabled"></ixfx-checkbox>
<ixfx-checkbox indeterminate label="Pending"></ixfx-checkbox>
```

### Properties / attributes

| Attribute / Property | Type      | Default | Description                          |
|----------------------|-----------|---------|--------------------------------------|
| `checked`            | `boolean` | `false` | Checked state (diagonal line)        |
| `indeterminate`      | `boolean` | `false` | Indeterminate state (horizontal bar) |
| `disabled`           | `boolean` | `false` | Disabled state                       |
| `label`              | `string`  | `''`    | Text label beside the box            |
| `name`               | `string`  | `''`    | Form field name                      |
| `value`              | `string`  | `''`    | Form field value                     |

### Events

| Event    | Detail                    | Description                  |
|----------|---------------------------|------------------------------|
| `change` | `{ checked: boolean }`    | Fired when checked state changes |

```js
document.querySelector('ixfx-checkbox').addEventListener('change', e => {
  console.log(e.detail.checked);
});
```

### CSS custom properties

| Property                  | Default                           | Description                     |
|---------------------------|-----------------------------------|---------------------------------|
| `--box-size`              | `18px`                            | Box width/height                |
| `--box-border-width`      | `2px`                             | Box border thickness            |
| `--box-border-color`      | `var(--surface-4)`                | Box border color                |
| `--box-bg-unchecked`      | `color-mix(...surface-3, surface-2)` | Background when unchecked     |
| `--box-bg-checked`        | `color-mix(...surface-3, surface-2)` | Background when checked       |
| `--check-line-color`      | `var(--accent)`                   | Diagonal / horizontal line color |
| `--check-line-width`      | `6px`                             | Line thickness                  |
| `--box-opacity-unchecked` | `0.5`                             | Opacity when unchecked          |
| `--box-opacity-checked`   | `1`                               | Opacity when checked            |
| `--box-opacity-hover`     | `var(--prominence-tickled-opacity)` | Opacity on hover             |
| `--box-opacity-disabled`  | `var(--prominence-disabled-opacity)` | Opacity when disabled        |
| `--label-gap`             | `var(--space-m)`                  | Gap between box and label       |
| `--label-fg`              | `var(--surface-3-text)`           | Label text color                |
| `--label-active`          | `var(--surface-2-text)`           | Label color when box clicked    |
| `--label-hover`           | `var(--surface-2-text)`           | Label color on hover            |
| `--label-opacity`         | `1`                               | Label opacity                   |
| `--label-opacity-unchecked` | `1`                             | Label opacity when unchecked    |
| `--transition-duration`   | `var(--transition)`               | Animation duration              |

### TypeScript types

```ts
import type { CheckboxChangeDetail } from 'ixfxfun-components';
```
