Floating Action Button

A tailwind floating action button: circular Material-style FAB with a plus icon and hover spin.

Tailwind CSS
<button aria-label="Create new" class="fixed bottom-6 right-6 z-50 w-14 h-14 rounded-full bg-indigo-600 text-white shadow-xl shadow-indigo-600/30 hover:bg-indigo-500 hover:scale-110 active:scale-95 transition-all duration-200 flex items-center justify-center group">
  <svg class="w-6 h-6 transition-transform duration-300 group-hover:rotate-90" fill="none" stroke="currentColor" stroke-width="2.5" viewBox="0 0 24 24"><path stroke-linecap="round" d="M12 5v14M5 12h14"/></svg>
</button>

Free to use in personal and commercial projects. No attribution required.

Variants

Same component, different looks. Preview each one live and copy the code you like.

Emerald

Fits green brand palettes and success themed actions like starting a chat.

Tailwind CSS

Extended pill

Adds a text label so first time users understand what the button does.

Tailwind CSS

Dark

Neutral black FAB that works on any page without committing to a brand color.

Tailwind CSS

About this floating action button

A tailwind floating action button is the circular Material-style button that hovers over content in the bottom corner of the screen. It holds the single most important action on the page: compose, create, or add. Borrowed from Material Design, the tailwind fab button has become the standard pattern for primary actions in dashboards and mobile web apps.

This floating action button css uses fixed positioning with a high z-index, a perfect circle (rounded-full with equal width and height), and a deep shadow so it lifts off the page. The plus icon rotates 90 degrees on hover through the group-hover utility, a small delight that signals the button is interactive. Scale transitions on hover and active give it a tactile press feel.

Use exactly one FAB per screen. It should represent the primary action and nothing else; secondary actions belong in menus or toolbars. Keep it clear of bottom navigation bars on mobile, and give it an aria-label since the icon alone means nothing to screen readers.

On a phone, the most-used action should live where the thumb already is. Burying compose or create inside a menu costs two taps and a hunt every single time, which adds up across dozens of uses a day. The floating action button pins that one action to the bottom corner, always one tap away. It follows Fitts's law directly: big target, screen edge, zero travel.

The button uses fixed positioning with a high z-index so it hovers above content, and equal width and height with rounded-full make the perfect circle. The tactile feel comes from pairing two scales: hover:scale-110 grows it slightly on hover, while active:scale-95 shrinks it on press. That shrink is what sells the physical press, since real buttons dip when pushed. A deep shadow lifts it off the page so it reads as floating, not pasted.

Hide the FAB on scroll down and reveal on scroll up, mirroring mobile browser chrome; a permanent circle over reading content is clutter. When the FAB opens a form, morph it into the form's submit area instead of layering a modal on top; the continuity feels crafted. Never place the FAB where it covers primary content like prices or CTAs; audit it on your smallest supported screen. If the action needs confirmation, expand to a mini dialog first; a destructive FAB with one-tap consequences is a support ticket generator.

A common failure is the FAB that never gets out of the way on reading pages. On article or documentation screens it hovers over text the visitor is trying to read, and there is no compose action that justifies it there. Hide the button on scroll down for content pages, or scope it to the routes where its action actually applies. A floating button with no relevant action is just an obstacle.

Where to use it

  • ✓ Dashboards (create new item)
  • ✓ Chat apps (new message)
  • ✓ Notes apps (new note)
  • ✓ Mobile web apps (primary action)

Customization tips

Build an extended variant by adding a text label inside a rounded-full pill. Shrink to w-12 h-12 for mini FABs, or stack a speed-dial that expands secondary actions on click. Match the color to your primary brand color.

Design notes

When to use

A floating action button holds the single most important action on the screen: compose, create, add, or start. It earns its floating position in mobile apps and dashboards where that action is used constantly and should be reachable with a thumb. The circular Material shape signals primary action, so the action behind it must deserve that weight.

What to avoid

Do not use a FAB for secondary actions, because promoting something minor to a floating button teaches users to ignore it. Never show more than one FAB at a time, and do not let it cover content, form fields, or the bottom navigation. On desktop pages with plenty of space, a normal inline button usually communicates better.

Accessibility

Label the button with what it does, like Create new post, never just plus, since screen readers announce the label. Keep it keyboard reachable in a sensible tab order and make sure it does not cover content when the page is zoomed.

Frequently asked questions

How do I create a floating action button in Tailwind?

Combine fixed bottom-6 right-6 z-50 with w-14 h-14 rounded-full, a strong shadow, and flex centering for the icon. Add hover:scale-110 and active:scale-95 for the tactile press effect.

Where should a material fab tailwind button be positioned?

Bottom-right is the standard. On mobile, raise it above the bottom tab bar so the two never overlap, and avoid covering primary content or input fields.

Can I put more than one FAB on a screen?

No. One FAB per screen is the rule. If you need several quick actions, use one FAB that expands into a speed-dial menu on tap instead.

How do I make a speed dial floating action button that expands into more options?

Stack secondary mini-FABs above the main button with absolute positioning and translate them upward when the menu opens. Stagger each one with a small transition-delay so they fan out in sequence. Label every action with a hover tooltip, since icon-only mini buttons are ambiguous on their own.

How do I add a tooltip to a floating action button on hover?

Wrap the FAB in a group container and add an absolutely positioned span with opacity-0 that becomes opacity-100 on group-hover. Set pointer-events-none on the tooltip so it never blocks clicks. Position it to the left of the button on desktop so it does not cover content below.

How do I keep a floating button from covering important page content?

Add padding-bottom to your main content equal to the button size plus its offset, so nothing important sits underneath it. Keep its z-index below modals and drawers so overlays always win. On pages where it would cover a key CTA, consider hiding it on that route entirely.

Customize it with our tools