Search documentation

Search the documentation and open a page.

A control that allows the user to toggle between checked and unchecked states.

Loading...

Installation

pnpm dlx shadcn@latest add @wirekyt/checkbox

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

InputTypeDefaultDescription
idstring | undefinedgeneratedUnique identifier used to create the checkbox part IDs.
idsCheckboxElementIds | undefined—Overrides the generated IDs for individual parts.
checkedCheckboxCheckedState | undefined—Checked state when controlled. Supports Angular two-way binding.
defaultCheckedCheckboxCheckedState | undefinedfalseInitial checked state when uncontrolled.
disabledbooleanfalseDisables interaction with the checkbox.
invalidbooleanfalseMarks the checkbox as invalid.
requiredbooleanfalseMarks the checkbox as required.
readOnlybooleanfalsePrevents changes while preserving focus and navigation.
namestring | undefined—Name used when submitting the checkbox with a form.
formstring | undefined—Associates the checkbox with a form by ID.
valuestring | undefined—Value submitted with the form when the checkbox is checked.
indeterminatebooleanfalseInitializes the checkbox in its indeterminate state.
cardbooleanfalseApplies the field structure and styling used by checkbox choice cards.

Outputs

OutputTypeDescription
checkedChangeCheckboxCheckedState | undefinedEmits the current checked state.
checkedDetailsChangeCheckboxCheckedChangeDetailsEmits details whenever the checked state changes.

[app-checkbox-group]

Inputs

InputTypeDefaultDescription
valuestring[] | undefined—Selected values when controlled. Supports Angular two-way binding.
defaultValuestring[] | undefined[]Initial selected values when uncontrolled.
namestring | undefined—Form name inherited by checkboxes in the group.
disabledbooleanfalseDisables every checkbox in the group.
readOnlybooleanfalsePrevents changes to every checkbox in the group.
invalidbooleanfalseMarks every checkbox in the group as invalid.
maxSelectedValuesnumber | undefinedunlimitedLimits the number of values that may be selected.

Outputs

OutputTypeDescription
valueChangestring[] | undefinedEmits the current selected values.

Context, Providers, and Utilities

ExportAngular API
CheckboxRootProviderDirective that provides an externally created checkbox API through value.
CheckboxGroupProviderDirective that provides an externally created checkbox-group API through value.
CheckboxContextStructural 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.
CheckboxImportsReadonly collection containing the checkbox UI and context helpers.

Types

ExportDescription
CheckboxApiConnected checkbox state and actions.
CheckboxCheckedStateChecked value: true, false, or "indeterminate".
CheckboxCheckedChangeDetailsDetails emitted by checkedDetailsChange.
CheckboxElementIdsOverrides for generated checkbox part IDs.
UseCheckboxReturnSignal-backed checkbox machine returned by useCheckbox.
UseCheckboxGroupReturnCheckbox-group state returned by useCheckboxGroup.
CheckboxGroupItemPropsValue used to derive the state of an item within a group.
CheckboxGroupItemContextDerived checked, form, and interaction state for a group item.