Icon Button

Material Design 3 icon button web component (standard + toggle).

  • 2.7 KB gzipped
  • @lit-material/icon-button 0.0.5
  • Renders on the server

Example

Install

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

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

API

<lit-material-icon-button>

Material Design 3 icon button.

Properties

PropertyAttributeTypeDefaultDescription
variantvariantIconButtonVariant"standard"
toggletogglebooleanfalse
selectedselectedbooleanfalse
disableddisabledbooleanfalse
typetypeIconButtonType"button"
namenamestring""
valuevaluestring""
formformstring | undefinednone
hrefhrefstring""If set, renders the button as a link (<a>) instead of a <button>.
targettargetstring""
ariaLabelaria-labelstring | nullnullForwarded to the inner control; icon buttons have no visible label so this is required.
ariaLabelledByaria-labelledbystring | nullnull

Events

EventDescription
change

Slots

SlotDescription
iconThe icon shown when the button is off (or always, when not a toggle).
selected-iconThe icon shown when a toggle button is selected.

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.

Source on GitHub npm