Skip to content

FAB, or Floating Action Button, is a stationary component that floats above other content in an interface.

Overview

FAB is commonly used anchored in a corner of the interface to be quickly accessible. Designed to be higher in the z-axis than most elements, use FAB sparingly and for critical actions. Avoid making FAB groups.

FAB is different than Button in that it has rounded corners and box-shadows and should be positioned above other content.

Usage

  • For actions that need visual prominence
  • For actions that need to be in a fixed position so content can flow beneath
  • For a single action on a busy background or map
  • For a prominent icon action that can exist without supporting text

Sample

Accessibility

Keyboard navigation

KeyFunction
SpacePresses the component.
EnterPresses the component.
TabMoves focus in and out of component.
Tab and ShiftMove focus in and out of component.

Writing and copy

Do FAB writing
Do use sentence case for FAB text.
Avoid FAB writing
Avoid using title case for FAB, and avoid using punctuation.
Do FAB actionable
Do make FAB text actionable.
Avoid FAB actionable
Avoid making FAB text unclear.
Do FAB consise
Do make FAB text concise.
Avoid FAB consise
Avoid making FAB text long or difficult to read.

API reference

Properties

PropertyAttributeDescriptionTypeDefault
appearanceappearanceSpecifies the component's appearance style.Extract<"solid" | "outline-fill", Appearance>"solid"
disableddisabledWhen true, prevents interaction and decreases the component's opacity.booleanfalse
iconiconSpecifies an icon to display.IconName
iconFlipRtlicon-flip-rtlWhen true and the element direction is right-to-left ("rtl"), flips the components icon`.booleanfalse
kindkindSpecifies the component's kind, which determines border and background styling.Extract<"brand" | "danger" | "inverse" | "neutral", Kind>"brand"
labellabelSpecifies an accessible label for the component.string | undefined
loadingloadingWhen true, a busy indicator is displayed.booleanfalse
scalescaleSpecifies the size of the component.Scale"m"
texttextSpecifies text to accompany the component's icon.string | undefined
textEnabledtext-enabledWhen true, displays the text value in the component.booleanfalse

Styles

NameDescription
--calcite-fab-background-colorSpecifies the component's background color.
--calcite-fab-border-colorSpecifies the component's border color.
--calcite-fab-corner-radiusSpecifies the component's corner radius.
--calcite-fab-text-colorSpecifies the component's text color.
--calcite-fab-loader-colorSpecifies the component's loader color.
--calcite-fab-shadowSpecifies the component's shadow.

Methods

NameDescriptionSignature
componentOnReadyCreate a promise that resolves once component is fully loaded.componentOnReady(): Promise<this>
setFocusSets focus on the component.setFocus(options?: FocusOptions): Promise<void>

Your browser is no longer supported. Please upgrade your browser for the best experience. See our browser deprecation post for more details.