Skip to content
Search
Search the documentation
Tooltip
GitHub
1 min read

Tooltip

A short note on a word or phrase, shown on hover, focus or tap.

Tooltip puts a short note on a word or phrase in a sentence, for a term the reader may not know.

Changes show up at once thanks to , and the build stays .

The words keep the sentence’s own font and colour, with a dotted underline that says there’s more to them. The note opens when the pointer rests on the words or the keyboard focuses them, and a tap opens it on a touch screen. A click keeps it open, and Escape or a click anywhere else closes it.

Usage

			<script>
	import { Tooltip } from 'svelte-docsmith';
</script>

Changes show up at once thanks to <Tooltip note="Hot module replacement">HMR</Tooltip>.
		

Keep the Tooltip on the same line as the words around it. A tag that starts a line begins a new block in markdown, and would end the paragraph there.

Keep the note to a sentence or two. A reader has to stop on the word to read it, so anything longer, or anything the reader needs to follow the page, belongs in the text itself or in a Callout.

For a note with formatting, pass a snippet:

			<Tooltip>
	{#snippet note()}Runs <code>vite build</code> and then checks every link.{/snippet}
	the build
</Tooltip>
		

API reference

Tooltip
note required stringSnippet
The note shown above the words.
children required Snippet
The words in the sentence that carry the note.

Was this page helpful?