Skip to Content

Hint

The Hint component provides tooltips and hints for other elements. It can be attached to buttons, icons, or any other UI elements to provide additional context or information when users hover over or interact with them.

Playground

Props

Examples

Positions

Shapes

Colors

Long Text with Wrap

Render as Child

By default, the Hint component wraps its children in a <span> element. This can sometimes cause layout issues or invalid HTML nesting (e.g. inside a <button>).

To avoid this, you can use the asChild prop. This will merge the hint’s functionality (classes, aria-label, etc.) directly onto the child element using @radix-ui/react-slot, effectively removing the wrapper.

Props

PropTypeDefaultDescription
alternateLabelstring-An alternate label to show when behaviour involves a state change.
asChildbooleanfalseMerges props onto the child element, removing the wrapper span.
behaviourHintBehaviour'hidden'Controls how and when the hint appears (e.g., show-on-hover, change-on-click).
childrenReactNode-The element that triggers the hint.
classNamestring-Additional CSS classes.
colorThemeColor'black'The background color of the hint.
labelstring-The text content of the hint.
positionHintPosition'top'The position of the hint relative to the child element.
shapeHintShape'round'The shape of the hint bubble (round, square, oblique).
sizeThemeSize'normal'The size of the hint text.
wrapbooleanfalseIf true, the hint text will wrap to fit within the viewport.

See also

Last updated on