Skip to main content

Tooltip

Library
UDS Base
Repository
github.com/telus/universal-design-system
Package
npmjs.com/package/@telus-uds/ds-allium
Package version
1.14.0
Loading...

Introduction

import { Tooltip } from '@telus-uds/ds-allium'

Tooltip provides a descriptive and detailed explanation or instructions. It can be used next to an input label to help a user fill the input, or as a standalone component.

Guidance

  • You may use one when the information is useful only to a small percentage of users (ie. tech savvy people wouldn't need this info).
  • Tooltips may also be useful when vertical space is an issue.

By default the TooltipButton component will be used as a control for triggering the tooltip, but you may attach a tooltip to any other component. A render function can be used to adjust the control's styling on state changes (hover, focus, etc.).

Loading...

Positioning

By default a Tooltip will be automatically positioned in a way that ensures it fits within the viewport. You may use the position prop to suggest a position - it will be used, unless the tooltip would end up outside the viewport.

Loading...

Accessibility

Tooltip's control is announced as a button with a label encouraging interaction. When open, the Tooltip receives an alert role, so that it's appearance is picked up by screen readers.

Platform considerations

The component is available on both native platforms and web.

Props

NameTypeDefaultDescription
childrenfunc | nodeUsed to render the control (i.e. tooltip trigger). If a render function is used it will receive the pressable state and tooltip variant as an argument.
contentstring | nodeThe message. Can be raw text or text components.
copy'en' | 'fr''en'Select English or French copy for the accessible label.
position'auto' | 'above' | 'right' | 'below' | 'left''auto'Use to place the tooltip in a specific location (only if it fits within viewport).
tokenscustomSystem tokens prop, see tokens for more details
variantobjectOfSystem variant prop, see variants for more details

Tokens

In exceptional circumstances, the following tokens can be passed to this component to override its default styles. Do not do this unless absolutely necessary. Read more about overriding styles.

View Tokens
Prop NameToken PropertyToken Type
tokensbackgroundColorcolor
paddingTopsize
paddingBottomsize
paddingLeftsize
paddingRightsize
borderRadiusradius
shadowshadow
colorcolor
fontSizefontSize
lineHeightlineHeight
fontNamefontName
fontWeightfontWeight
arrowWidthsize
arrowBorderRadiusradius
arrowOffsetsize

Figma

Variants

Inverse

  • Use on dark backgrounds.
Loading...

Feedback