Documentation
Feedback
Guides
Storefront Development

Storefront Development
FastStore
Tooltip

Tooltip provides contextual information.

Tooltip is a component that provides contextual information when users hover over or click an element.
Example
Code

Import

Import the component from @faststore/ui

_10
import { Tooltip } from '@faststore/ui'

Import styles into your FastStore project

To apply the styles of this component in your FastStore project, import the following into your stylesheet:

_10
@import '@faststore/ui/src/components/molecules/Tooltip/styles.scss';

Follow the instructions in the Importing FastStore UI component styles tutorial.

Props

NameTypeDescriptionDefault
content*string | number | false | true | {} | ReactElement<any, string | JSXElementConstructor<any>> | Iterable<ReactNode> | ReactPortalText/content of the tooltip.
placement"top-start" | "top-center" | "top-end" | "right-start" | "right-center" | "right-end" | "bottom-start" | "bottom-center" | "bottom-end" | "left-start" | "left-center" | "left-end"Defines the side or side-alignment (e.g., "top-center", "right-end") of the tooltip.top-center
dismissiblefalse | trueIf the tooltip can be closed by a button.false
onDismiss(ev: any) => voidCalled when the dismiss button is clicked.
children*string | number | false | true | {} | ReactElement<any, string | JSXElementConstructor<any>> | Iterable<ReactNode> | ReactPortalElement that activates the tooltip on hover/focus.
testIdstringID to find this component in testing tools (e.g.: cypress, testing library, and jest).fs-tooltip
maxWidthnumberMaximum width of the tooltip.300
describedByIdstringID for the tooltip content to be used with aria-describedby.tooltip-content

Design tokens

Local tokenDefault value/Global token linked
--fs-button-heightvar(--fs-control-tap-size)
--fs-tooltip-z-indexvar(--fs-z-index-high)
--fs-tooltip-background
var(--fs-color-neutral-6)
--fs-tooltip-text-color
var(--fs-color-text-inverse)
--fs-tooltip-border-radiusvar(--fs-border-radius)
--fs-tooltip-paddingvar(--fs-spacing-2)
--fs-tooltip-gapvar(--fs-spacing-1)
--fs-tooltip-transition-propertyopacity
--fs-tooltip-transition-timingvar(--fs-transition-timing)
--fs-tooltip-transition-functionvar(--fs-transition-function)

Nested elements

Indicator

Local tokenDefault value/Global token linked
--fs-tooltip-indicator-sizevar(--fs-spacing-1)
--fs-tooltip-indicator-distance-edgevar(--fs-spacing-3)
--fs-tooltip-indicator-distance-basevar(--fs-spacing-1)
--fs-tooltip-indicator-translatecalc(var(--fs-tooltip-indicator-size) + var(--fs-tooltip-indicator-distance-base))

Customization

For further customization, you can use the following data attributes:
data-fs-tooltip
data-fs-tooltip-wrapper
data-fs-tooltip-content
data-fs-tooltip-dismiss-button
data-fs-tooltip-indicator
Contributors
2
Photo of the contributor
Photo of the contributor
Was this helpful?
Yes
No
Suggest Edits (GitHub)
Contributors
2
Photo of the contributor
Photo of the contributor
On this page