mirror of
https://github.com/hanzoai/svelte.git
synced 2026-10-01 00:41:47 +00:00
21 lines
506 B
Svelte
21 lines
506 B
Svelte
<!-- TooltipTrigger — the hover/focus target; describes itself with the tip. -->
|
|
<script lang="ts">
|
|
import { getDisclosure, TOOLTIP } from './internal/context'
|
|
|
|
let className: string | undefined = undefined
|
|
export { className as class }
|
|
|
|
const { open, contentId } = getDisclosure(TOOLTIP, 'TooltipTrigger')
|
|
</script>
|
|
|
|
<button
|
|
type="button"
|
|
aria-describedby={$open ? contentId : undefined}
|
|
data-slot="tooltip-trigger"
|
|
class={className}
|
|
on:click
|
|
{...$$restProps}
|
|
>
|
|
<slot />
|
|
</button>
|