Fine-tune light, shadows, borders, neumorphic
Light and shadows
Borders
Neumorphic
Actions

Fab <pm-fab>

Floating action button: the main action of a screen, fixed in a corner, with an optional menu of actions.

Full screen
Document Folder Upload

Props

<script type="module"> import '@prismora/css'; import '@prismora/elements/button'; import '@prismora/elements/fab'; import '@prismora/elements/icon'; import { registerIcons } from '@prismora/elements/icon'; import { fileText, folder, plus, shoppingCart, upload } from '@prismora/icons'; registerIcons([fileText, folder, plus, shoppingCart, upload]); </script> <div class="pm-cluster" style="--pm-gap: var(--pm-space-8); align-items: end; min-block-size: 12rem"> <pm-fab inline label="Create" icon="plus"> <pm-button icon-start="file-text">Document</pm-button> <pm-button icon-start="folder">Folder</pm-button> <pm-button icon-start="upload">Upload</pm-button> </pm-fab> <pm-fab inline extended label="New order"> <pm-icon slot="icon" name="shopping-cart"></pm-icon> </pm-fab> </div>

Variants

Set with the variant attribute.

Document Folder Upload
variant="solid"
Document Folder Upload
variant="soft"
Document Folder Upload
variant="outline"

Sizes

Set with the size attribute; controls keep touch-sized targets on phones.

Document Folder Upload
size="sm"
Document Folder Upload
size="md"

Tones

Set tone on the element, or data-tone on any ancestor to tone a whole area.

Document Folder Upload
tone="accent"
Document Folder Upload
tone="secondary"
Document Folder Upload
tone="neutral"
Document Folder Upload
tone="success"
Document Folder Upload
tone="warning"
Document Folder Upload
tone="danger"
Document Folder Upload
tone="info"

Overview

On its own it is one button (href makes it a link). Put buttons or links in it and it becomes a speed dial: pressing it opens them above it, the arrow keys move between them, and Escape, choosing one or pressing outside closes it. It stays clear of the home indicator and sits above the tab bar of a native phone layout. inline keeps it in the flow of the page.

Attributes

AttributeTypeDefaultDescription
labelstring—What the button does, e.g. "Create". It is the accessible name, and the visible text with extended.
iconstring—Registered icon name (see registerIcons). Without one, a plus.
extendedbooleanfalseShow the label next to the icon.
hrefstring—Make the button a link (when it has no actions).
openbooleanfalseThe speed dial is open. Setting it opens or closes it.
position'end' | 'start' | 'center'—Corner of the screen: end (default), start or center.
inlinebooleanfalseStay in the flow of the page instead of floating.
size'sm' | 'md'—Size of the main button: sm or md (default).
variant'solid' | 'soft' | 'outline'—Look of the main button (default solid).

Also accepts the contextual attributes tone, surface, radius, density, motion, elevation. They are inherited from ancestors' data-* attributes.

Events

EventReact / Svelte propDescription
pm-toggleonPmToggleThe speed dial opened or closed by the user. detail.open is the new state.
pm-openonPmOpenThe speed dial opened.
pm-closeonPmCloseThe speed dial closed.

Slots

SlotDescription
(default)Actions of the speed dial: <pm-button> elements, buttons or links.
iconYour own icon for the main button.

CSS parts

PartDescription
::part(button)The main button.
::part(actions)The list of actions.

Methods

show(), hide(), toggle(), close()