Loading...
Installation
Install the following dependencies:
Copy and paste the following code into your project.
Loading...
Update the import paths to match your project setup.
Composition
<label app-checkbox> ├── generated checkbox control and indicators ├── label content (optional) └── generated hidden input [app-checkbox-group] (optional) └── <label app-checkbox>
Examples
Choice Cards
Loading...
Default
Loading...
Group
Loading...
Invalid
Loading...
Nested
Loading...
Table Rows
Loading...
API Reference
<label app-checkbox>
Inputs
| Input | Type | Default | Description |
|---|---|---|---|
id | string | undefined | generated | Unique identifier used to create the checkbox part IDs. |
ids | CheckboxElementIds | undefined | — | Overrides the generated IDs for individual parts. |
checked | CheckboxCheckedState | undefined | — | Checked state when controlled. Supports Angular two-way binding. |
defaultChecked | CheckboxCheckedState | undefined | false | Initial checked state when uncontrolled. |
disabled | boolean | false | Disables interaction with the checkbox. |
invalid | boolean | false | Marks the checkbox as invalid. |
required | boolean | false | Marks the checkbox as required. |
readOnly | boolean | false | Prevents changes while preserving focus and navigation. |
name | string | undefined | — | Name used when submitting the checkbox with a form. |
form | string | undefined | — | Associates the checkbox with a form by ID. |
value | string | undefined | — | Value submitted with the form when the checkbox is checked. |
indeterminate | boolean | false | Initializes the checkbox in its indeterminate state. |
card | boolean | false | Applies the field structure and styling used by checkbox choice cards. |
Use [(checked)]="checked" for two-way binding, or combine [checked] with (checkedChange)
when using signals. The component also implements Angular's ControlValueAccessor for forms
integration.
Outputs
| Output | Type | Description |
|---|---|---|
checkedChange | CheckboxCheckedState | undefined | Emits the current checked state. |
checkedDetailsChange | CheckboxCheckedChangeDetails | Emits details whenever the checked state changes. |
[app-checkbox-group]
Inputs
| Input | Type | Default | Description |
|---|---|---|---|
value | string[] | undefined | — | Selected values when controlled. Supports Angular two-way binding. |
defaultValue | string[] | undefined | [] | Initial selected values when uncontrolled. |
name | string | undefined | — | Form name inherited by checkboxes in the group. |
disabled | boolean | false | Disables every checkbox in the group. |
readOnly | boolean | false | Prevents changes to every checkbox in the group. |
invalid | boolean | false | Marks every checkbox in the group as invalid. |
maxSelectedValues | number | undefined | unlimited | Limits the number of values that may be selected. |
Outputs
| Output | Type | Description |
|---|---|---|
valueChange | string[] | undefined | Emits the current selected values. |
Context, Providers, and Utilities
| Export | Angular API |
|---|---|
CheckboxRootProvider | Directive that provides an externally created checkbox API through value. |
CheckboxGroupProvider | Directive that provides an externally created checkbox-group API through value. |
CheckboxContext | Structural directive [checkbox-context] exposing the root API to a template. |
useCheckbox(options) | Creates the signal-backed checkbox machine inside an Angular injection context. |
useCheckboxGroup(options) | Creates checkbox-group state inside an Angular injection context. |
injectCheckboxContext() | Injects the nearest checkbox root context. |
injectCheckboxGroupContext() | Injects the nearest checkbox-group context. |
injectCheckboxGroupContextOptional() | Injects the nearest checkbox-group context when one exists. |
CheckboxImports | Readonly collection containing the checkbox UI and context helpers. |
Types
| Export | Description |
|---|---|
CheckboxApi | Connected checkbox state and actions. |
CheckboxCheckedState | Checked value: true, false, or "indeterminate". |
CheckboxCheckedChangeDetails | Details emitted by checkedDetailsChange. |
CheckboxElementIds | Overrides for generated checkbox part IDs. |
UseCheckboxReturn | Signal-backed checkbox machine returned by useCheckbox. |
UseCheckboxGroupReturn | Checkbox-group state returned by useCheckboxGroup. |
CheckboxGroupItemProps | Value used to derive the state of an item within a group. |
CheckboxGroupItemContext | Derived checked, form, and interaction state for a group item. |
Angular
React
Solid
Svelte
Vue