HomeGetting StartedColor SystemTypographySpacingIconographyLayoutInstallationUsageAngularBlazorReactSvelteVueThemingTypographyCustomizationCSS-Only ComponentsFormsIconsIllustrationsAccessibilityGlobal ConfigurationTailwind CSSSass LibraryForge MCP ServerDropdown OptionsFocus Indicator ClippingAll componentsButtonButton AreaChipFloating Action ButtonIcon ButtonSplit ButtonAutocompleteButton ToggleCalendarCheckboxChip FieldColor PickerDate PickerDate Range PickerFile PickerLabelRadioSelectSliderSwitchText FieldTime PickerApp BarApp LauncherDrawerMenuPaginatorSkip LinkStepperTabsView SwitcherAccordionApp LayoutCardDividerExpansion PanelScaffoldSplit ViewStackStructured CardToolbarBadgeBannerBusy IndicatorCircular ProgressDialogInline MessageLinear ProgressPage StateSkeletonToastTooltipAvatarIconKeyLabel ValueListMeterSecretTableTimelineTimestampTreeKeyboard ShortcutPopoverIntroductionColorTypographySpacingShapeBorderElevationLayeringAnimationUsageIcon LibraryBlocksRoadmapChangelogBlog

Floating Action Button

Floating action buttons represent the single most important action on a page, positioned above other content to draw attention to it.

Create

Overview

A floating action button (FAB) is a prominent, circular button that performs the primary or most common action on a screen. Primarily designed for mobile interfaces, it appears in front of all screen content and provides immediate access to the most important user action within the current context.

FABs are characterized by their elevated appearance, circular shape with centered icons, and persistent positioning that remains visible as users scroll through content.

Usage

forge-fab represents a page’s single most important action through theme, density, and elevation. Use the default slot alone for an icon-only FAB, or add the label slot for an extended FAB with a text label. Reserve it for pages that truly have one primary action; when several actions are equally likely, reach for a button instead.

Rules

Do
Use a FAB only when a page has one clear primary action.Use when the primary action is constructive (creating, adding, or starting something new).Mobile interfaces benefit from prominent, easily accessible action buttons.Use when the action is relevant across most or all content on the screen.Place the icon before the label in an extended FAB.Use where users frequently perform the same action throughout their workflow.Reserve elevation="lowered" for a FAB that already sits on a raised surface, like a card.
Don't
Don't display more than one FAB on a page.Don't use a FAB for a minor or destructive action, like archiving or showing an error.Don't position a FAB where it obscures important content or controls.Don't use when multiple primary actions are equally likely - for example, if adding and editing records are equally probable, use regular buttons instead.

Positioning

forge-fab doesn’t position itself — fix it to a corner of the viewport (or a scroll container) yourself, typically with position: fixed and a spacing token for the offset:

.bottom-right {
  position: fixed;
  bottom: var(--forge-spacing-medium);
  right: var(--forge-spacing-medium);
}

Density

Set density to small, medium (the default), or large to match the FAB’s surrounding context.

Small, medium (default), and large density.

Extended

Add a label slot for an extended FAB with a text label — use it for actions that don’t have a familiar icon.

An icon paired with a label slot switches the FAB into its extended form.

Wrap an <a> in the default slot to get a navigating FAB instead of one that fires a click action.

A FAB wrapping an anchor for navigation.

Floating action buttons are used to represent the most important action on a page. They are typically used in mobile applications, and are positioned above other content in a way that draws attention to them.

import "@tylertech/forge/floating-action-button";
Properties
PropertyAttributeTypeDefaultDescription
themethemeButtonTheme'secondary'Gets/sets the theme of the button.
densitydensityFloatingActionButtonDensity'medium'Gets/sets the density of the button.
elevationelevationFloatingActionButtonElevation'raised'Gets/sets the elevation of the button.
typetypeButtonType'button'Gets/sets the type of button.
disableddisabledbooleanfalseGets/sets whether the button is disabled.
densedensebooleanfalseGets/sets whether the button is dense.
popoverIconpopover-iconbooleanfalseGets/sets whether to show a popover icon.
namenamestring''Gets/sets the button name for form association.
valuevaluestring''Gets/sets the button value for form submission.
commandcommandCommandType''Indicates to the targeted element which action to take.
commandForcommand-forstring''Targets another element to be invoked.
commandForElement—HTMLElement | undefinedundefinedTargets another element to be invoked.
Events
NameTypeDescription
clickPointerEventFires when the button is clicked.
Slots
NameDescription
(default)This is a default/unnamed slot. Typically used for icon-only or label-only FABs. If the content forces the width to be large than the height, then the FAB will be in extended mode.
startAn element to logically render at the start of the button content.
labelReserved specifically for label text. This forces the button into extended mode.
endAn element to logically render at the end of the button content.
CSS Parts
NameDescription
::part(root)The root container element.
::part(focus-indicator)The focus-indicator indicator element.
::part(state-layer)The state-layer surface element.
CSS Custom Properties
NameDescription
--forge-fab-background-displayThe display property.
--forge-fab-gapThe gap between the icon and the label.
--forge-fab-backgroundThe background color.
--forge-fab-colorThe text color.
--forge-fab-sizeThe height and min-width of the button.
--forge-fab-paddingThe inline padding of the button.
--forge-fab-shadowThe box shadow of the button.
--forge-fab-hover-shadowThe box shadow of the button when hovered.
--forge-fab-active-shadowThe box shadow of the button when active.
--forge-fab-lowered-shadowThe box shadow of the button when lowered.
--forge-fab-lowered-hover-shadowThe box shadow of the button when lowered and hovered.
--forge-fab-lowered-active-shadowThe box shadow of the button when lowered and active.
--forge-fab-transition-durationThe transition duration.
--forge-fab-transition-timingThe transition timing function.
--forge-fab-shapeThe border radius of the button.
--forge-fab-shape-start-startThe start-start border radius.
--forge-fab-shape-start-endThe start-end border radius.
--forge-fab-shape-end-startThe end-start border radius.
--forge-fab-shape-end-endThe end-end border radius.
--forge-fab-extended-paddingThe inline padding of the extended button.
--forge-fab-extended-min-widthThe min-width of the extended button.
--forge-fab-density-small-sizeThe height and min-width of the small density button.
--forge-fab-density-medium-sizeThe height and min-width of the medium density (default) button.
--forge-fab-density-large-sizeThe height and min-width of the large density button.
--forge-fab-disabled-cursorThe cursor when disabled.
--forge-fab-disabled-backgroundThe background color when disabled.
--forge-fab-disabled-colorThe text color when disabled.
--forge-fab-disabled-opacityThe opacity when disabled.
Methods
NameReturnsDescription
click()void
focus(options)void

Labeling

A FAB that only contains an icon needs a meaningful accessible name via aria-label or aria-labelledby — the icon alone doesn’t convey its purpose to assistive technology.

Avoid capitalized label text; screen readers read capitalized words character-by-character. Use text-transform: uppercase instead so the visual style doesn’t affect what gets announced.

Keyboard and contrast

  • Make sure the FAB can be reached by keyboard navigation, with a distinct visual cue when it’s focused.
  • Verify sufficient contrast between the FAB’s foreground and background to meet WCAG requirements — including against whatever page content it floats above.
Loading Forge chat…