Components
Fab
Buttons providing easy access to important actions
Text Fab
A text fab pairs a leading icon with a label. It renders the small preferences icon by default, matching its most common use as a persistent filter action.
<TextFabV2> Filters </TextFabV2>
Secondary Text Fab
<TextFabV2 theme="secondary"> Filters </TextFabV2>
With filters applied
When count is greater than zero, a numeric badge showing the number of applied filters replaces the leading icon. This maps to the Figma component's hasFiltersApplied and count properties, collapsed into a single count prop. In the secondary theme the background also switches to the default surface color.
<TextFabV2 count={2}> Filters </TextFabV2>
<TextFabV2 count={2} theme="secondary" > Filters </TextFabV2>
Icon Fab
An icon fab renders a single medium icon. Because it has no visible text, accessibilityLabel is required.
<IconFabV2 accessibilityLabel="Add" icon={<ContentActionsAddMedium />} />
Secondary Icon Fab
<IconFabV2 accessibilityLabel="Add" icon={<ContentActionsAddMedium />} theme="secondary" />
Positioning
Fabs float above the page content but do not position themselves — wrap the fab in a positioned container so the placement stays under the consumer's control. The demo below pins the fab to the bottom-right of a position: relative frame that stands in for the viewport.
<div className="relative ba b-dashed b-gray-300 br3 h6"> <div className="absolute bottom2 right2"> <TextFabV2> Filters </TextFabV2> </div> </div>
On a real surface the wrapper is fixed to the viewport instead (offset any fixed chrome, such as a bottom nav bar, with a larger bottom value):
<div className="fixed bottom2 right2"><TextFabV2 onClick={openFilters}>Filters</TextFabV2></div>
Props
TextFabV2
childrenrequiredLabel text for the fab.
TypeReact.ReactNodethemeTheme that decides the style of the button.
Type'primary' | 'secondary'Default'primary'countNumber of applied filters. When greater than zero, a numeric badge replaces the leading icon.
TypenumbericonLeading icon rendered before the label. Must be one of the
smallicons from Thumbprint Icons. Defaults to the small preferences icon.TypeReact.ReactNodeonClickFunction that runs when the fab is activated by mouse, touch, or keyboard. Pointer activation receives a real DOM
MouseEvent, soevent.preventDefault()/event.stopPropagation()work; keyboard activation receives a synthetic event (the fab has no default action to cancel).Type(event: React.MouseEvent<HTMLElement>) => voidaccessibilityLabelDescription of the fab content for assistive technologies. Only needed if the label text is not descriptive enough.
TypestringdataTestIdA selector hook into the React component for use in automated testing environments.
Typestring
IconFabV2
iconrequiredIcon from Thumbprint Icons to render within the button. It must be one of the
mediumicons.TypeReact.ReactNodeaccessibilityLabelrequiredDescription of the fab content for assistive technologies. Required because the button contains only an icon and no descriptive text.
TypestringthemeTheme that decides the style of the button.
Type'primary' | 'secondary'Default'primary'onClickFunction that runs when the fab is activated by mouse, touch, or keyboard. Pointer activation receives a real DOM
MouseEvent, soevent.preventDefault()/event.stopPropagation()work; keyboard activation receives a synthetic event (the fab has no default action to cancel).Type(event: React.MouseEvent<HTMLElement>) => voiddataTestIdA selector hook into the React component for use in automated testing environments.
Typestring