Tooltip
Short labels on hover and focus. Pure CSS; the text is a real element referenced by aria-describedby.
Placements
Add to library
Opens in a new tab
Copy to clipboard
<span class="mn-tooltip"><button class="mn-btn mn-btn-outline" aria-describedby="tt1">Top</button><span role="tooltip" id="tt1">Add to library</span></span>
<span class="mn-tooltip mn-tooltip-bottom"><button class="mn-btn mn-btn-outline" aria-describedby="tt2">Bottom</button><span role="tooltip" id="tt2">Opens in a new tab</span></span>
<span class="mn-tooltip mn-tooltip-right"><button class="mn-btn mn-btn-icon mn-btn-outline" aria-label="Copy" aria-describedby="tt3"><svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><rect x="9" y="9" width="12" height="12" rx="2"/><path d="M5 15H4a1 1 0 0 1-1-1V4a1 1 0 0 1 1-1h10a1 1 0 0 1 1 1v1"/></svg></button><span role="tooltip" id="tt3">Copy to clipboard</span></span>Installation
Everything ships in one stylesheet. There is nothing to import per component.
<link rel="stylesheet" href="https://mian.ro/dist/mian.css">Prefer to own the files? /r/tooltip.json is a registry item with this component's CSS and example markup, ready to copy into your project with any tool that reads the open registry-item format.
Class reference
| Class / attribute | Description |
|---|---|
| mn-tooltip | Wrapper around the trigger and a role="tooltip" element. |
| mn-tooltip-bottom · mn-tooltip-left · mn-tooltip-right | Placement (top is default). |
Accessibility
- Link the tooltip with aria-describedby so screen readers read it. Tooltips appear on keyboard focus, not only hover. Never put essential or interactive content in a tooltip.