Skip to main content
Home pageComponentsTooltip

Tooltip

A non-interactive floating label anchored to a trigger element. Tooltips appear on hover and keyboard focus, and disappear when the user moves away. Use them to describe controls whose purpose isn't fully obvious from their visible label.

Playground​

HTMLReact
ShareCopy

Usage​

<lt-tooltip content="Above" placement="top"><button>Top</button></lt-tooltip>
<lt-tooltip content="Below" placement="bottom"><button>Bottom</button></lt-tooltip>
<lt-tooltip content="Start side" placement="start"><button>Start</button></lt-tooltip>
<lt-tooltip content="End side" placement="end"><button>End</button></lt-tooltip>

<lt-tooltip content="Primary" background="--lt-color-primary-600" color="#fff">
<button>Token bg</button>
</lt-tooltip>

<lt-tooltip content="You can't do that" disabled>
<button disabled>Locked</button>
</lt-tooltip>

<!-- Waits 500ms before showing, so a fast mouse pass-through never flashes it -->

<lt-tooltip content="Delayed" delay="500">
<button>Hover and wait</button>
</lt-tooltip>

<!-- Stays open briefly when the pointer leaves, so it can be reached to select/copy its text -->

<lt-tooltip content="a1b2c3d4-e5f6-7890-abcd-ef1234567890" hoverable>
<code>Copy ID</code>
</lt-tooltip>

<!-- A tap shows it immediately; tap again, tap elsewhere, or press Escape to dismiss -->

<lt-tooltip content="Encrypted with your device's passcode" touch>
<code>Why is this locked?</code>
</lt-tooltip>
import { Tooltip } from '@latty-ds/react';

<Tooltip content="Above" placement="top">
<button>Top</button>
</Tooltip>
<Tooltip content="Below" placement="bottom">
<button>Bottom</button>
</Tooltip>
<Tooltip content="Start side" placement="start">
<button>Start</button>
</Tooltip>
<Tooltip content="End side" placement="end">
<button>End</button>
</Tooltip>

<Tooltip content="Primary" background="--lt-color-primary-600" color="#fff">
<button>Token bg</button>
</Tooltip>

{/* Waits 500ms before showing, so a fast mouse pass-through never flashes it */}

<Tooltip content="Delayed" delay={500}>
<button>Hover and wait</button>
</Tooltip>

{/* Stays open briefly when the pointer leaves, so it can be reached to select/copy its text */}

<Tooltip content="a1b2c3d4-e5f6-7890-abcd-ef1234567890" hoverable>
<code>Copy ID</code>
</Tooltip>

{/* A tap shows it immediately; tap again, tap elsewhere, or press Escape to dismiss */}

<Tooltip content="Encrypted with your device's passcode" touch>
<code>Why is this locked?</code>
</Tooltip>
<template>
<lt-tooltip content="Above" placement="top"><button>Top</button></lt-tooltip>
<lt-tooltip content="Below" placement="bottom"><button>Bottom</button></lt-tooltip>
<lt-tooltip content="Start side" placement="start"><button>Start</button></lt-tooltip>
<lt-tooltip content="End side" placement="end"><button>End</button></lt-tooltip>

<lt-tooltip content="Primary" background="--lt-color-primary-600" color="#fff">
<button>Token bg</button>
</lt-tooltip>

<!-- Waits 500ms before showing, so a fast mouse pass-through never flashes it -->

<lt-tooltip content="Delayed" delay="500">
<button>Hover and wait</button>
</lt-tooltip>

<!-- Stays open briefly when the pointer leaves, so it can be reached to select/copy its text -->

<lt-tooltip content="a1b2c3d4-e5f6-7890-abcd-ef1234567890" hoverable>
<code>Copy ID</code>
</lt-tooltip>

<!-- A tap shows it immediately; tap again, tap elsewhere, or press Escape to dismiss -->

<lt-tooltip content="Encrypted with your device's passcode" touch>
<code>Why is this locked?</code>
</lt-tooltip>
</template>

API​