Floating Action Menu

PreviousNext

A floating action button that springs open into a staggered stack of labelled actions.

Installation

pnpm dlx shadcn@latest add https://matos-ui.com/r/floating-action-menu.json

Usage

import {
  FloatingActionMenu,
  type FloatingActionItem
} from '@/components/matos-ui/floating-action-menu'
import { Pencil, Share2 } from 'lucide-react'
const items: FloatingActionItem[] = [
  { id: 'edit', label: 'Edit', icon: <Pencil className="size-5" /> },
  { id: 'share', label: 'Share', icon: <Share2 className="size-5" /> }
]

<FloatingActionMenu items={items} />

Reference

FloatingActionMenu Props

PropTypeDefaultDescription
itemsFloatingActionItem[]-Actions revealed when the menu opens.
stiffnessnumber420Spring stiffness for the reveal and rotation.
dampingnumber20Spring damping for the reveal and rotation.

FloatingActionItem

FieldTypeDescription
idstringUnique key for the action.
labelstringTooltip label and aria-label.
iconReactNodeIcon rendered in the button.
onClick() => voidClick handler for the action.