Components › Components
Tooltip
A short hint for a button, shown on hover and on focus. The tooltip is a hint popover placed next to its trigger by CSS anchor positioning, and it's the trigger's accessible description.
Styled: Tooltip on ui.clarusjs.com, ready to copy, in plain CSS or Tailwind.
Copies the page's address
tscl
@import uiTooltip from '@clarusjs/ui-primitives/tooltip.tscl'
@import uiTooltipTrigger from '@clarusjs/ui-primitives/tooltip-trigger.tscl'
<uiTooltipTrigger target="copy-tip">Copy link</uiTooltipTrigger>
<uiTooltip id="copy-tip" side="bottom">Copies the page's address</uiTooltip>side:top(the default),bottom,leftorright; it flips when there's no room.- Shown on hover (after a short delay) and on focus; it stays while the pointer is on it, and closes on Escape, blur or leaving. Browsers with interest invokers (
interestfor) do this themselves; elsewhere the trigger, a small island, does. - Short text only. Nothing in a tooltip can be clicked; use a popover for that.
- Styling:
data-part="tooltip",:popover-open, anddata-side.
From @clarusjs/ui-primitives, styled by @clarusjs/ui: @import '@clarusjs/ui/ui.css' once, and change the look with its --ui- tokens (--ui-accent, --ui-radius, --ui-font…). Without it, the part is unstyled and works the same.