Checkbox
Natywne pole wyboru ze stanem nieokreślonym, połączone z etykietą przez pole formularza, do formularzy i list „zaznacz wszystko”.
Dostępny w
Angular: dostępny Vue: dostępny React: dostępny React Native: dostępny
Użycie
Partly read.
<div soneFieldGroup variant="choices" style="max-width: 26rem">
<div soneField orientation="horizontal">
<input soneCheckbox id="demo-terms" [(indeterminate)]="partial" [checked]="terms()" (change)="terms.set(!terms())" />
<div soneFieldContent>
<label soneFieldLabel for="demo-terms">Accept terms and conditions</label>
<p soneFieldDescription>{{ partial() ? 'Partly read' : terms() ? 'Accepted' : 'Not accepted' }}.</p>
</div>
</div>
<div soneField orientation="horizontal">
<input soneCheckbox id="demo-updates" checked />
<label soneFieldLabel for="demo-updates">Email me product updates</label>
</div>
<div soneField orientation="horizontal" disabled>
<input soneCheckbox id="demo-locked" checked disabled />
<label soneFieldLabel for="demo-locked">Keep a backup (managed)</label>
</div>
</div>Import
import {
SoneCheckboxDirective,
} from "@surface-one/angular/checkbox";Dokumentacja API
SoneCheckboxDirectiveDyrektywa
`input[soneCheckbox]` — the native checkbox (spartan/ui Checkbox, native first): it stays an `<input type="checkbox">`, so `[checked]`, `(change)`, `ngModel`, `formControl`, `required` and a `<label for>` all work as they do on any checkbox, and the global form styles draw it. The directive adds the mixed state the markup cannot express: `[(indeterminate)]`, cleared when the user toggles it.
| Nazwa | Typ | Domyślnie |
|---|---|---|
indeterminatedwukierunkoweThe mixed state ("some of them") — `[(indeterminate)]`; a click clears it. | boolean | false |