Skip to main content brightness_auto motion_photos_off palette download more_vert
toc

Checkbox

Checkboxes let people select one or more items from a set, or turn an option on or off.

<label>
  <md-gb-checkbox></md-gb-checkbox>
  Remember me
</label>

Install with shadcn/ui: npx shadcn@latest add https://material-web.dev/3.0/r/md-checkbox.json (setup)

  • Select from a set. Use checkboxes when people can pick any number of options from a list, or to turn one option on or off.
  • Label every checkbox. The label is the adjacent text, and it should say what checking the box does.
  • Use a parent for a group. A parent checkbox shows an indeterminate state when only some of its children are checked.
  • Don't apply density by default. Let people opt in to a denser layout.

A checkbox is one element. A <label> next to it, or around it, provides the text.

<label>
  <md-gb-checkbox></md-gb-checkbox>
  Send me updates
</label>

Add checked for a selected checkbox. Add indeterminate for a parent whose children are partly selected.

<label>
  <md-gb-checkbox checked></md-gb-checkbox>
  Email
</label>
<label>
  <md-gb-checkbox indeterminate></md-gb-checkbox>
  All notifications
</label>

Add error to mark a checkbox as invalid. With required, it must be checked to submit a form.

<label>
  <md-gb-checkbox required error></md-gb-checkbox>
  I accept the terms
</label>

A disabled checkbox can't be changed.

<label>
  <md-gb-checkbox disabled></md-gb-checkbox>
  Unavailable option
</label>

Set density from 0 (default) to -3 to shrink the checkbox. The touch target stays 48px.

<label>
  <md-gb-checkbox density="-2"></md-gb-checkbox>
  Compact option
</label>

Call linkParentCheckbox(parent, children) from checkbox-group.js. Checking the parent checks every child, and a partial selection makes the parent indeterminate.

HTMLTS
<label>
  <md-gb-checkbox id="all"></md-gb-checkbox>
  All notifications
</label>
<label>
  <md-gb-checkbox class="channel" checked></md-gb-checkbox>
  Email
</label>
<label>
  <md-gb-checkbox class="channel"></md-gb-checkbox>
  Push
</label>
  • The adjacent <label> text is the checkbox's accessible name. Use aria-label when there is no visible label or it needs more detail.
  • Space toggles the focused checkbox, and Tab moves between checkboxes.
  • A checkbox exposes its checked, unchecked or mixed state.
<md-gb-checkbox aria-label="Select all messages"></md-gb-checkbox>
Material Design 3Spec checked80% tokens

45 of 82 buildable spec units are tested, 4 are excluded with a written reason and 0 are uncovered (the target is 0). 43 of 54 token declarations match the spec (80%), and 11 have no spec token.

BaselineWidely availableChrome 124Edge 124Firefox 125Safari 17.4

The component’s own CSS and JavaScript rely only on web platform features that are Baseline widely available: it works in Chrome 124, Edge 124, Firefox 125, Safari 17.4 and later.

It uses no newer features.

WAI-ARIAaxe and ARIA 1.3 passCheckbox

Roles the component renders: checkbox (opens in a new tab), textbox (opens in a new tab).

Follows the WAI-ARIA Authoring Practices: Checkbox (opens in a new tab).

2 rendered states run through axe-core and the WAI-ARIA 1.3 role and attribute rules in a real browser, with no known gaps.

Lighthouse97 · 100 · 100 · 100
  • Performance
  • Accessibility
  • Best practices
  • SEO

Audits under 90:

  • Eliminate render-blocking resources
  • Minify JavaScript
  • Enable text compression
  • Network dependency tree
  • Render blocking requests

Lighthouse 12.8.2 (desktop, 2026-11-08) on the component alone: its first example on a page of its own, without this site's shell. The modules are the development build (not bundled or minified), so the performance score is indicative.

A Material Design component.

Property Attribute Type Default
checked
Whether or not the checkbox is selected.
checked boolean false
density
The density, from 0 (default) to -3. Each step down removes 4px from the checkbox's layout box (48px) and state layer (40px); the touch target stays 48px. Values are clamped to that range. checkbox.md: don't apply density by default; let people opt in to a denser layout.
density Density
error
Whether or not the checkbox is invalid.
error boolean false
indeterminate
Whether or not the checkbox is indeterminate. https://developer.mozilla.org/en-US/docs/Web/HTML/Element/input/checkbox#indeterminate_state_checkboxes
indeterminate boolean false
required
When true, require the checkbox to be selected when participating in form submission. https://developer.mozilla.org/en-US/docs/Web/HTML/Element/input/checkbox#validation
required boolean false
value
The value of the checkbox that is submitted with a form when selected. https://developer.mozilla.org/en-US/docs/Web/HTML/Element/input/checkbox#value
value string 'on'
Event Description
change
Event
Fired when the checkbox is checked or unchecked.
input
InputEvent
Fired when the checkbox is checked or unchecked.
Part Description
::part(checkbox) The checkbox's root element.
Property Description
--container-color
--container-shape
--container-size
--density-step Size removed per density step.
--icon-color
--icon-size
--outline-color
--outline-width
--state-layer-color
--state-layer-shape
--state-layer-size State layer size at density 0.
--target-size The minimum touch target size, kept at any density.
Install Material Web 3.0

Your browser did not offer to install the docs as an app. Install them from the browser instead:

Close
Send feedback
Bug Documentation Idea

Opens a new GitHub issue for material-components/material-web in a new tab, with this filled in.

Cancel Open issue