FAB (Floating Action Button)
A circular primary action fixed over content—usually bottom-right—reserved for the screen’s one main create action.
Also known as floating action button · round plus button · speed dial
Demo · not production-ready code
Prompt for AI
Pick a stack, copy a ready prompt, paste into Cursor / Claude / ChatGPT.
Your stack
Shapes the prompt you copy
React + Tailwind + shadcn/ui · EN
Stack: React + Tailwind + shadcn/ui. Use React with Tailwind CSS and shadcn/ui patterns (Radix-based primitives, cn(), class-first styling). Task: implement "FAB (Floating Action Button)". Add a FAB: 56px circular primary-color button fixed bottom-right, offset by calc(16px + env(safe-area-inset-bottom)), shadow above scrolling content, aria-label naming the action, extra bottom padding on the list so last-row actions stay tappable. At most one per screen, for the single most important creative action. Anatomy: - FAB: About 56px circle; at most one floating primary action per screen. - speed dial: Optional fan-out of secondary actions from the main FAB. - inset offset: Clear home indicators and system gesture zones. Preferred API / pattern: `custom fixed button / MUI Fab patterns` Keep scope minimal: only this UI pattern, match existing project style.
Acceptance checks
- ○Avoid: Last list row covered by the FAB
- ○Avoid: Icon-only without aria-label
- ○Avoid: Destructive action as FAB
- ○Avoid: Ignoring safe area
- ○Avoid: Two FABs on one screen
In plain wordsHow people search for it
AnatomyOpen for part names
- FAB
- About 56px circle; at most one floating primary action per screen.
- speed dial
- Optional fan-out of secondary actions from the main FAB.
- inset offset
- Clear home indicators and system gesture zones.
How to write itOpen for stack patterns
position: fixed + border-radius: 50%custom fixed button / MUI Fab patternsoverlay alignment + circular Button<FloatButton icon /> / FloatButton.GroupNotes
Material’s signature control means “the single most important action on this screen”—compose, post, add expense. One per screen, positive/create oriented; a delete FAB is a footgun. It steals hit area from list bottoms—pad the scroll content. Solid fill or shadow keeps it readable over busy backgrounds. Always give an aria-label; icon-only is mute to screen readers.
Common mistakesHumans and models trip here
- Last list row covered by the FAB: bottom padding must clear FAB height + gap.
- Icon-only without aria-label: screen readers announce “button”.
- Destructive action as FAB: floating red delete is an accidental-tap magnet.
- Ignoring safe area: sits under the home indicator.
- Two FABs on one screen: same sin as two primary buttons.
More failure symptoms on AI broke it.
Related patterns
Spotted a wrong name or missing pattern?