FAB

Material Design 3 floating action button (FAB) web component.

  • 3.1 KB gzipped
  • @lit-material/fab 0.0.3
  • Renders on the server

Example

Install

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

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

API

<lit-material-fab>

Material Design 3 floating action button (FAB) — the primary action for a screen, built on the same button/ripple/focus-ring/form-association pattern as lit-material-button and lit-material-icon-button.

Properties

PropertyAttributeTypeDefaultDescription
sizesizeFabSize"regular"
colorcolorFabColor"primary"
extendedextendedbooleanfalse
disableddisabledbooleanfalse
typetypeFabType"button"
namenamestring""
valuevaluestring""
formformstring | undefinednone
hrefhrefstring""If set, renders the FAB as a link (<a>) instead of a <button>.
targettargetstring""
ariaLabelaria-labelstring | nullnullForwarded to the inner control. Required unless extended's visible label is enough on its own.
ariaLabelledByaria-labelledbystring | nullnull

Slots

SlotDescription
iconThe action's icon.
defaultThe label text, shown only while extended is set.

CSS parts

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

Source on GitHub npm