All components

Checkbox

Enable an optional setting.

Examples

Enable an optional setting

React code
import { Label, Checkbox } from "@accelerate/react/components";

export function Example() {
  return (
    <>
      <Label><Checkbox name="email" defaultChecked /> Send a confirmation email</Label>
    </>
  );
}
Angular code
import { Component } from "@angular/core";
import { AccLabel, AccCheckbox } from "@accelerate/angular/components";

@Component({
  selector: "app-example",
  imports: [
    AccLabel,
    AccCheckbox,
  ],
  template: `
    <label accLabel><input accCheckbox name="email" checked> Send a confirmation email</label>
  `,
})
export class Example {}

Disabled option

React code
import { Label, Checkbox } from "@accelerate/react/components";

export function Example() {
  return (
    <>
      <Label><Checkbox disabled /> Send an SMS alert</Label>
    </>
  );
}
Angular code
import { Component } from "@angular/core";
import { AccLabel, AccCheckbox } from "@accelerate/angular/components";

@Component({
  selector: "app-example",
  imports: [
    AccLabel,
    AccCheckbox,
  ],
  template: `
    <label accLabel><input accCheckbox disabled> Send an SMS alert</label>
  `,
})
export class Example {}

Installation

Source preview. The expanded component catalog is ahead of the public npm releases. To run these examples in your own application, use packages built from the SDK source used for the previews or a release that includes the APIs below.

React
@accelerate/ui@0.4.0 and @accelerate/react@0.4.0
Angular
@accelerate/ui@0.4.0 and @accelerate/angular@0.2.0

Load @accelerate/ui/theme.css and put acc-theme on the app or the region using Accelerator components. See the framework setup guide for the theme and adapter conventions.

Usage

Native checkbox including form submission, disabled state and indeterminate DOM property.

Import the React component Checkbox from @accelerate/react/components. For Angular, add AccCheckbox to the standalone component’s imports and use <input accCheckbox>.

Examples use these React parts: Label, Checkbox. The Angular examples show the corresponding directives and template hosts.

API reference

checked
Sets the initial native selection.
indeterminate
Set the DOM property for a partial selection state.
disabled
Prevents changes and excludes the input from form submission.