Skip to main content

Tooltip

A short hint on hover or focus.

Left out of Brand expressive Visitors come from social posts on their phones, where hover hints never show. Every button has a word instead. Use instead: Button, Popover

See it live​

Start Storybook to see it live: npm run storybook

When to use it​

  • Use it when: A brief name or hint for a control that already has an accessible name.
  • Not when: The only place values or important words live, or touch screens, where hover never happens.

Instead:

How Brand expressive uses it​

An icon with no label
Use Not used: always add a word
Not An icon button with a hover hint
On phones, hover hints never show; a word says what will happen.

Words​

  • Headlines are short and bold. Three to six words.
  • Verbs that move: Join, Try, Go.
  • Playful in headlines, plain in errors.
  • Use: Join, Drop, Go, Love. Avoid: Synergy, Leverage, Kindly.

The labels components use, from the voice tokens:

  • content.action.commit: Go
  • content.action.cancel: Not now
  • content.action.destroy: Remove
  • content.action.retry: Try again
  • content.action.empty-action: Explore the drop

See Voice and tone for the whole voice.

Accessibility and keyboard​

KeyboardWhat happensNot
undefinedEscape hides it.undefined

Test before you ship:

  • It describes its trigger and also shows on keyboard focus. undefined

Use it in code​

npx open-ds add tooltip

The component reads only component keys and semantic tokens, so it follows the brand and mode on <html>.

Tokens it reads​

Tooltip reads 7 tokens of its own, each an alias of a semantic token. Each row is one part: its own token, the semantic it aliases, and the value it ends at. Change a semantic and every component that reads it follows; override one of Tooltip's tokens to change Tooltip alone.

Changes with theme

Brand expressive decides what changes when you switch theme. Here a switch changes colors only, so the marked rows differ between light and dark; everything else holds steady.

PartIts token and the semantic it aliasesValue
Tooltip
Fill
Changes with theme
component.tooltip.backgroundcolor.surface.inversevar(--tooltip-background)Lighttaupe.light.900:#1F1411Darktaupe.dark.900:#FFF8F3
Text
Changes with theme
component.tooltip.labelcolor.text.inversevar(--tooltip-label)Lighttaupe.light.0:#FFFFFFDarktaupe.light.900:#1F1411
Content
Cornercomponent.tooltip.content.radiusradius.badgevar(--tooltip-content-radius)radius.999:9999px
Padding, left and rightcomponent.tooltip.content.padding-xspace.gap.defaultvar(--tooltip-content-padding-x)space.16:1rem
Padding, top and bottomcomponent.tooltip.content.padding-ycomponent-spacing-map.x1var(--tooltip-content-padding-y)space.4:0.25rem
Text sizecomponent.tooltip.content.font-sizetype.caption.font-sizevar(--tooltip-content-font-size)font.size.14:0.875rem
Font familycomponent.tooltip.content.font-familytype.caption.font-familyvar(--tooltip-content-font-family)font.family.dm-sans:"DM Sans", system-ui, sans-serif