Floating Action Button (FAB) Template

Provide users with constant access to a primary action using this elegant floating button.

This button stays in a fixed position as the user scrolls, making it an excellent choice for actions like creating a new item, composing a message, or starting a chat.

Screenshot of a circular floating action button fixed to the corner of the screen.

Get Source Code Preview

About the Floating Action Button

The Floating Action Button (FAB) is a UI pattern popularized by Google's Material Design. It's a circular, icon-only button that "floats" above the main content of the page, typically anchored to a corner. Its purpose is to present a promoted, primary action in a way that is immediately accessible, regardless of where the user is on the page. This template is particularly effective on mobile interfaces where space is at a premium.

Features

Code Breakdown

The CSS uses position: fixed combined with the bottom and right properties to lock the button to the bottom-right corner. A high z-index value ensures it stays above other content. The circular shape is created with a border-radius: 50%. Inside the button, Flexbox is used to perfectly center the SVG icon.

Code

Here is the complete, self-contained code for the Floating Action Button.

View Output