Skip to main content

Tooltip

A short hint on hover or focus.

Left out of Multi-brand Customers use any device, and on touch screens hover hints never show; a popover explains a fee instead. Use instead: 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 Multi-brand uses it​

An icon with no label
Use Not used: always add a word; a popover explains a fee
Not An icon button with a hover hint
On touch screens hover hints never show; a word says what will happen.

Words​

  • Shared structure: object, state, next step.
  • Brand tone lives in headlines and marketing copy, not in errors.
  • Errors and confirmations read the same in every brand.
  • Use: Get started, Plan, Order. Avoid: Brand-specific words in errors, Jargon.

The labels components use, from the voice tokens:

  • content.action.commit: Save
  • content.action.cancel: Cancel
  • content.action.destroy: Remove
  • content.action.retry: Try again
  • content.action.empty-action: Get started

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

Multi-brand decides what changes when you switch theme. Here a switch changes colors, type and shape, so the marked rows differ between its brands and 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)Aster Lightslate-deep.light.900:#0F172AAster Darkslate-deep.dark.900:#F8FAFCBirch Lightslate-deep.light.900:#0F172ABirch Darkslate-deep.dark.900:#F8FAFCCoral Lightslate-deep.light.900:#0F172ACoral Darkslate-deep.dark.900:#F8FAFC
Text
Changes with theme
component.tooltip.labelcolor.text.inversevar(--tooltip-label)Aster Lightslate-deep.light.0:#FFFFFFAster Darkslate-deep.light.900:#0F172ABirch Lightslate-deep.light.0:#FFFFFFBirch Darkslate-deep.light.900:#0F172ACoral Lightslate-deep.light.0:#FFFFFFCoral Darkslate-deep.light.900:#0F172A
Content
Corner
Changes with theme
component.tooltip.content.radiusradius.badgevar(--tooltip-content-radius)Aster Lightradius.4:0.25remAster Darkradius.4:0.25remBirch Lightradius.999:9999pxBirch Darkradius.999:9999pxCoral Lightradius.999:9999pxCoral Darkradius.999:9999px
Padding, left and rightcomponent.tooltip.content.padding-xspace.gap.defaultvar(--tooltip-content-padding-x)space.12:0.75rem
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.13:0.8125rem
Font family
Changes with theme
component.tooltip.content.font-familytype.caption.font-familyvar(--tooltip-content-font-family)Aster Lightfont.family.inter:Inter, system-ui, sans-serifAster Darkfont.family.inter:Inter, system-ui, sans-serifBirch Lightfont.family.plus-jakarta-sans:"Plus Jakarta Sans", system-ui, sans-serifBirch Darkfont.family.plus-jakarta-sans:"Plus Jakarta Sans", system-ui, sans-serifCoral Lightfont.family.poppins:Poppins, system-ui, sans-serifCoral Darkfont.family.poppins:Poppins, system-ui, sans-serif