{"slug":"tooltip","name":"Tooltip","category":"Overlays","summary":"A short label shown on hover or focus.","status":"stable","since":"0.2.0","import":"import { Tooltip } from '@elluzion/iv-ui';","usage":["Wrap the trigger; `label` is the tooltip text and the child stays the trigger.","`delay` defaults to 300 ms; Escape hides an open tooltip.","Tooltips supplement a visible label; they never replace one."],"props":[{"name":"label","type":"string","default":"''","description":"Tooltip text.","required":false,"bindable":false},{"name":"position","type":"TooltipPosition","default":"'top'","description":"Preferred side of the trigger.","required":false,"bindable":false},{"name":"delay","type":"number","default":"300","description":"Delay before showing, in milliseconds.","required":false,"bindable":false},{"name":"disabled","type":"boolean","default":"false","description":"Disables interaction and applies the disabled treatment.","required":false,"bindable":false},{"name":"className","type":"string","default":"''","description":"Extra classes merged onto the root element.","required":false,"bindable":false}],"events":[],"snippets":[{"name":"content","type":"Snippet","default":null,"description":"Custom tooltip content replacing the label.","required":false,"bindable":false},{"name":"children","type":"Snippet","default":null,"description":"The trigger element.","required":true,"bindable":false}],"types":[{"name":"TooltipPosition","kind":"type","code":"type TooltipPosition = 'top' | 'bottom' | 'left' | 'right';","description":"Side of the trigger the tooltip prefers."}],"manual":[],"tokens":["--iv_border-hover","--iv_font-mono","--iv_foreground","--iv_leading-tight","--iv_radius-sm","--iv_shadow-md","--iv_spacing-md","--iv_spacing-xs","--iv_surface-elevated","--iv_text-body-sm","--iv_z-dropdown"],"cssHooks":["iv-ready","iv-root","iv-tooltip"],"accessibility":{"keyboard":[["Escape","Hides an open tooltip."]],"notes":["The wrapper points at the tooltip with `aria-describedby` only while it is visible.","Focus and hover both open the tooltip; leaving or blurring closes it.","Touch devices do not show hover tooltips, so keep the information available in the interface."]},"related":[{"title":"Popover","summary":"A floating panel anchored to an element.","url":"/components/popover","kind":"Component"},{"title":"Shortcut","summary":"Renders a keyboard combination as key caps.","url":"/components/shortcut","kind":"Component"},{"title":"Menu","summary":"A vertical list of commands, options, or links.","url":"/components/menu","kind":"Component"},{"title":"Button","summary":"Triggers an action or submits a form.","url":"/components/button","kind":"Component"}],"examples":[{"id":"positions","title":"Positions","description":"The preferred side flips automatically when space runs out.","code":"<script lang=\"ts\">\n\timport { Button, Tooltip } from '@elluzion/iv-ui';\n</script>\n\n<div class=\"row\">\n\t{#each ['top', 'bottom', 'left', 'right'] as side (side)}\n\t\t<Tooltip label=\"{side} tooltip\" position={side as 'top' | 'bottom' | 'left' | 'right'}>\n\t\t\t<Button variant=\"outline\" size=\"sm\">{side}</Button>\n\t\t</Tooltip>\n\t{/each}\n</div>\n\n<style>\n\t.row {\n\t\tdisplay: flex;\n\t\tflex-wrap: wrap;\n\t\tjustify-content: center;\n\t\tgap: var(--iv_spacing-sm);\n\t}\n</style>"},{"id":"delay","title":"Delay","description":"A short delay for dense toolbars, a longer one for prose.","code":"<script lang=\"ts\">\n\timport { Button, Tooltip } from '@elluzion/iv-ui';\n</script>\n\n<div class=\"row\">\n\t<Tooltip label=\"Opens immediately\" delay={0}>\n\t\t<Button variant=\"outline\" size=\"sm\">No delay</Button>\n\t</Tooltip>\n\t<Tooltip label=\"Opens after 700 ms\" delay={700}>\n\t\t<Button variant=\"outline\" size=\"sm\">Long delay</Button>\n\t</Tooltip>\n</div>\n\n<style>\n\t.row {\n\t\tdisplay: flex;\n\t\tflex-wrap: wrap;\n\t\tjustify-content: center;\n\t\tgap: var(--iv_spacing-sm);\n\t}\n</style>"},{"id":"rich","title":"Custom content","description":"The `content` snippet can hold a shortcut, a hint, or both.","code":"<script lang=\"ts\">\n\timport { Button, Shortcut, Tooltip } from '@elluzion/iv-ui';\n</script>\n\n<Tooltip position=\"bottom\">\n\t{#snippet content()}\n\t\t<span class=\"content\">Command palette <Shortcut keys={['⌘', 'K']} /></span>\n\t{/snippet}\n\t<Button variant=\"outline\" size=\"sm\">Open palette</Button>\n</Tooltip>\n\n<style>\n\t.content {\n\t\tdisplay: inline-flex;\n\t\talign-items: center;\n\t\tgap: var(--iv_spacing-sm);\n\t}\n</style>"}],"markdown":"/components/tooltip.md","page":"/components/tooltip"}