Button

Material Design 3 button web component (filled, outlined, text, elevated, tonal).

  • 3.2 KB gzipped
  • @lit-material/button 0.3.0
  • Renders on the server

Example

Install

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

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

API

<lit-material-button>

Material Design 3 button.

Properties

PropertyAttributeTypeDefaultDescription
variantvariantButtonVariant"filled"
typetypeButtonType"button"
disableddisabledbooleanfalse
namenamestring""
valuevaluestring""
formformstring | undefinednone
hrefhrefstring""If set, renders the button as a link (<a>) instead of a <button>.
targettargetstring""

Slots

SlotDescription
defaultThe button's label.
iconAn optional leading icon.

CSS parts

PartDescription
buttonThe native <button> or <a> element rendered inside the shadow root.
rippleThe state-layer element the hover/press feedback is drawn on.
focus-ringThe focus indicator element.

CSS custom properties

PropertyDescription
--lit-material-button-heightButton height (default 40px).
--lit-material-button-padding-inlineLeft and right padding (default 24px).
--lit-material-button-text-padding-inlineThe same for variant="text" (default 12px).
--lit-material-button-shapeCorner radius (default --md-sys-shape-corner-full).
--lit-material-button-shape-startStart-side corners (default --lit-material-button-shape).
--lit-material-button-shape-endEnd-side corners (default --lit-material-button-shape).
--lit-material-button-pressed-scaleScale while pressed, e.g. 0.98 (default 1; off under reduced motion).

Source on GitHub npm