Checkbox

Material Design 3 checkbox web component (checked, indeterminate, error, and form participation).

  • 2.7 KB gzipped
  • @lit-material/checkbox 0.0.4
  • Renders on the server

Example

Install

npm install @lit-material/checkbox @lit-material/tokens
import "@lit-material/checkbox";

Link @lit-material/tokens/css/index.css once per page for the colour, type and shape tokens. Install guide

API

<lit-material-checkbox>

Material Design 3 checkbox.

Properties

PropertyAttributeTypeDefaultDescription
checkedcheckedbooleanfalse
indeterminateindeterminatebooleanfalseVisual-only "partially checked" state; cleared on the next user interaction.
disableddisabledbooleanfalse
errorerrorbooleanfalse
requiredrequiredbooleanfalse
namenamestring""
valuevaluestring"on"
formformstring | undefinednone
ariaLabelaria-labelstring | nullnullForwarded to the inner control; checkboxes have no visible label so this is often required.
ariaLabelledByaria-labelledbystring | nullnull

Events

EventDescription
changeBubbles when the checked state changes via user interaction.

CSS parts

PartDescription
checkboxThe container the state layer, focus ring, and box are rendered in.
iconThe svg containing the box outline and check/indeterminate mark.
rippleThe state-layer element the hover/press feedback is drawn on.
focus-ringThe focus indicator element.

Source on GitHub npm