BrowseCheckbox

Controls

Glass Checkbox

A tick box whose mark draws itself in, with a label, description and a mixed state.

Preview

Installation

Install the package once, then import the parts you use into a standalone component.

Install

npm install ngx-vitreo @angular/cdk @floating-ui/dom
Import

import { GlassCheckbox } from 'ngx-vitreo';

@Component({
  imports: [GlassCheckbox],
  // ...
})

Usage

Usage

<glass-panel class="cpreview-choices" variant="card">
  <glass-checkbox
    label="All channels"
    [checked]="overall()"
    (checkedChange)="setAll($event)"
  />
  <div class="cpreview-choices-nested">
    @for (channel of channels; track channel) {
      <glass-checkbox
        size="sm"
        [label]="channel"
        [checked]="selected().includes(channel)"
        (checkedChange)="setChannel(channel, $event)"
      />
    }
  </div>
</glass-panel>

API reference

GlassCheckbox

<glass-checkbox>, button[glassCheckbox]

InputTypeDefaultDescription
[(checked)]boolean | 'indeterminate'falseChecked state; 'indeterminate' shows a dash for a parent of several choices. (checkedChange) emits when the user toggles the box.
labelstringNoneText beside the box; clicking it toggles the box. Use button[glassCheckbox] with aria-label for a bare box.
descriptionstringNoneMuted line under the label, linked with aria-describedby. Shown only with a label.
size'sm' | 'md''md'Box size: 16px or 20px.
disabled / requiredbooleanfalseNative form state, mirrored to data-disabled and aria-required.
name / valuestring — / 'on' Submits the box with a native form when checked.
ngModel / formControlControlValueAccessorNoneBinds the value to a template-driven or reactive form, including disabled state.