Floating Action Button
Menus and commandsWeb + NativeMITAnchored floating action button with optional expanding actions menu.
bun add @otfdashkit/ui
Preview
Floating Action ButtonMenus and commands
Code
@otfdashkit/uiimport { Settings } from 'lucide-react'
import { FloatingActionButton, Switch } from '@otfdashkit/ui'
export function Example() {
return (
<div className="relative w-full h-[400px] bg-background flex items-center justify-center">
<div className="text-center space-y-1">
<p className="text-sm font-semibold text-foreground">FloatingActionButton</p>
<p className="text-xs text-muted-foreground">Generic FAB — any icon, any sections</p>
</div>
<FloatingActionButton
icon={<Settings className="h-[18px] w-[18px]" />}
label="Open settings"
title="Quick Settings"
position="bottom-right"
sections={[
{
label: 'Notifications',
content: (
<div className="space-y-2">
{['Email alerts', 'Push', 'Digest'].map(item => (
<div key={item} className="flex items-center justify-between">
<span className="text-xs text-foreground">{item}</span>
<Switch />
</div>
))}
</div>
),
},
]}
/>
</div>
)
}
Free with the SDK. This block ships in @otfdashkit/ui under the MIT license.
Props
Props declared in the FloatingActionButton source. Inherited HTML attributes are not listed.
| Prop | Type | Default | Description |
|---|---|---|---|
| className | string | Extra className on the root wrapper. | |
| description | string | Panel subtitle shown below the title. | |
| icon | ReactNode | Icon rendered inside the FAB. Defaults to a palette icon. | |
| label | string | 'Open panel' | Tooltip / aria-label for the FAB button. |
| position | 'bottom-right' | 'bottom-left' | 'top-right' | 'top-left' | 'bottom-right' | Which corner to anchor the FAB. |
| sections | FabSection[] | [] | Sections of content to render inside the popover panel. |
| title | string | Panel title shown at the top of the popover. |