# u-checkbox

```ts
import '@iyulab/components/dist/components/checkbox/UCheckbox.js';
```

**Tag:** `u-checkbox`

Checkbox with `indeterminate` state support. Form-associated (`formAssociated = true`).

```html
<u-checkbox name="agree" required>I agree to the terms</u-checkbox>

<u-checkbox checked color="green" appearance="outlined">
  Enabled feature
</u-checkbox>

<!-- Indeterminate (partial selection) -->
<u-checkbox indeterminate>Select all</u-checkbox>
```

---

## Slots

| Name | Description |
|------|-------------|
| *(default)* | Label text |

## Properties

| Property | Type | Default | Reflect | Description |
|----------|------|---------|---------|-------------|
| `checked` | `boolean` | `false` | ✓ | Checked state |
| `indeterminate` | `boolean` | `false` | ✓ | Partial / indeterminate state |
| `appearance` | `'solid'\|'outlined'` | `'solid'` | ✓ | `solid` fills the checked box with the colour · `outlined` colours the border and checkmark |
| `color` | `'primary'\|'secondary'\|'info'\|'success'\|'warning'\|'danger'\|'blue'\|'green'\|'red'\|'orange'\|'teal'\|'cyan'\|'purple'\|'pink'\|'neutral'` | `'primary'` | ✓ | Accent color — role axis (`primary`…`danger`, follows rebranding) and decorative axis (`blue`…, the palette colour itself, immune to it). `neutral` is grey. `primary` fills with the selection colour `--u-selection-color` (the primary colour unless the theme sets it) |
| `disabled` | `boolean` | `false` | ✓ | Disable the control |
| `readonly` | `boolean` | `false` | ✓ | Read-only |
| `required` | `boolean` | `false` | ✓ | Required field |
| `invalid` | `boolean` | `false` | ✓ | Validation failed state |
| `name` | `string` | — | — | Form field name |
| `value` | `string` | — | — | Submitted value |
| `label` | `string` | — | — | Label (alternative to slot) |
| `validationMessage` | `string` | — | — | Error text shown while `invalid` — replaces the message the browser computed (`validation-message="…"` in a template). Text only: it does not make the value invalid; `setCustomValidity()` does that |

## Methods

| Method | Returns | Description |
|--------|---------|-------------|
| `validate()` | `boolean` | Run validation; sets `invalid` |
| `reset()` | `void` | Clear value and validation state |
| `focus(options?)` | `void` | Focus the checkbox input |
| `blur()` | `void` | Blur the checkbox input |

## CSS Parts

| Part | Description |
|------|-------------|
| `wrapper` | Outer layout wrapper |
| `input` | Hidden native `<input>` |
| `checkbox` | Visual checkbox box |
| `label` | Label text element |
| `description` | Description text |

## CSS Custom Properties

| Property | Description |
|----------|-------------|
| `--checkbox-color` | Checkmark color (`outlined`) |
| `--checkbox-border-color` | Border color |
| `--checkbox-background-color` | Fill color when checked (`solid`) |
