# TallStackUI: Checkbox Group
> TallStackUI is a TALL Stack (Tailwind CSS, Alpine.js, Laravel, Livewire)
> component library providing 80+ Blade components for building modern web interfaces.
A group of checkbox options rendered from an array, in one of four presentations:
stacked rows, cards, panels or an inline segmented control. The selected state is
driven entirely by CSS, so no Alpine component is involved.
## Basic Usage
```blade
```
```blade
```
The bound property must be an array:
```php
public array $features = [];
```
Out of the Livewire context, use an array `name` and an array `value`:
```blade
```
Every input shares the same `name`. When it is not given, it falls back to the
`id`, then to the bound property, always suffixed with `[]` so a plain form
submission collects the options as an array.
## Attributes
| Attribute | Type | Default | Description |
|------------|-------------------|-------------|------------------------------------------------------------------------------|
| id | string\|null | null | Base id for the generated inputs, suffixed with the option index |
| label | string\|null | null | Group label, rendered as the fieldset legend |
| hint | string\|null | null | Hint text displayed below the group |
| list | string\|null | null | Presentation flag: stacked rows; the default when none is given |
| card | string\|null | null | Presentation flag: independent cards in a grid |
| panel | string\|null | null | Presentation flag: cards with a check icon, control hidden |
| inline | string\|null | null | Presentation flag: horizontal segmented control |
| color | string\|null | 'primary' | Color theme of the selected option |
| select | string\|null | from config | Remaps the option keys, e.g. `label:name\|value:id`. Inline overrides config |
| columns | int\|null | 3 | Grid columns for 'card' and 'panel', between 1 and 4 |
| position | string\|null | 'left' | Control side on 'list' and 'card': 'left' or 'right' |
| required | bool\|null | false | Adds the asterisk to the legend |
| invalidate | bool\|null | null | Prevents displaying validation error messages |
| xs | string\|null | null | Sets the control size to extra small when present |
| sm | string\|null | null | Sets the control size to small when present |
| md | string\|null | null | Sets the control size to medium (default) when present |
| lg | string\|null | null | Sets the control size to large when present |
| options | Collection\|array | [] | The selectable options |
`required` only marks the legend here. The native `required` attribute is never
set on the inputs, since the browser would then demand every box be checked.
## Variants
Each presentation is a flag, not a value. Passing none renders `list`, and when
more than one is given the first of `card`, `panel`, `inline` wins.
```blade
```
| Variant | Layout | Control |
|----------|----------------------------------------------------------------|-----------|
| `list` | Stacked rows sharing borders, rounded at the ends of the stack | Visible |
| `card` | Independent cards in a responsive grid | Visible |
| `panel` | Cards with a check icon marking the selection | `sr-only` |
| `inline` | Horizontal segmented control | `sr-only` |
The `sr-only` control on `panel` and `inline` stays in the tab order and toggles
with Space.
## Option Keys
| Key | Type | Required | Ignored by |
|---------------|--------|----------|------------|
| `label` | string | yes | — |
| `value` | scalar | yes | — |
| `description` | string | no | `inline` |
| `aside` | string | no | `inline` |
| `icon` | string | no | — |
| `image` | string | no | `inline` |
| `badge` | string | no | `inline` |
| `disabled` | bool | no | — |
`image` takes precedence over `icon` when both are present.
The `select` attribute remaps the source keys with the same syntax used by
``, and any part left out falls back to the key of the same name:
```blade
```
## Configuration
Configuration via `config/tallstackui.php` under `components.checkbox.group`:
| Key | Default | Description |
|--------|---------|-----------------------------------------------------------------|
| select | null | Default option key mapping, same syntax as the inline attribute |
```php
'checkbox.group' => [
TallStackUi\Components\Form\Checkbox\Group\Component::class,
[
'select' => 'label:name|value:id',
],
],
```
The inline attribute always wins, and with neither every key falls back to the
key of the same name.
## Customizing an Option
`@interact('option', $option)` replaces the body of every item. The `