Usage
Use a Button or any other component in the default slot of the Tooltip.
<template>
<B24Tooltip text="Open on GitHub">
<B24Button label="Open" />
</B24Tooltip>
</template>
App component which uses the TooltipProvider component from Reka UI.Text
Use the text prop to set the content of the Tooltip.
<template>
<B24Tooltip text="Open on GitHub">
<B24Button label="Open" />
</B24Tooltip>
</template>
Kbds
Use the kbds prop to render Kbd components in the Tooltip.
<template>
<B24Tooltip
text="Open on GitHub"
:kbds="{
'0': 'meta',
'1': 'G'
}"
>
<B24Button label="Open" />
</B24Tooltip>
</template>
meta that displays as ⌘ on macOS and Ctrl on other platforms.Delay
Use the delay-duration prop to change the delay before the Tooltip appears. For example, you can make it appear instantly by setting it to 0.
<template>
<B24Tooltip :delay-duration="0" text="Open on GitHub">
<B24Button label="Open" />
</B24Tooltip>
</template>
tooltip.delayDuration option in the App component.Content
Use the content prop to control how the Tooltip content is rendered, like its align or side for example.
<template>
<B24Tooltip
:content="{
align: 'center',
side: 'bottom',
sideOffset: 8
}"
text="Open on GitHub"
>
<B24Button label="Open" />
</B24Tooltip>
</template>
Arrow
Use the arrow prop to display an arrow on the Tooltip.
<template>
<B24Tooltip text="Open on GitHub">
<B24Button label="Open" />
</B24Tooltip>
</template>
Disabled
Use the disabled prop to disable the Tooltip.
<template>
<B24Tooltip disabled text="Open on GitHub">
<B24Button label="Open" />
</B24Tooltip>
</template>
Examples
Control open state
You can control the open state by using the default-open prop or the v-model:open directive.
defineShortcuts, you can toggle the Tooltip by pressing O.With following cursor
You can make the Tooltip follow the cursor when hovering over an element using the reference prop:
Help Icon
You can use the Icon and the Tooltip.
API
Props
Slots
Emits
Theme
export default defineAppConfig({
b24ui: {
tooltip: {
slots: {
content: 'dark flex flex-row items-center justify-between gap-[5px] will-change-[opacity] min-h-[37px] shadow-xl/20 select-none motion-safe:data-[state=delayed-open]:animate-[scale-in_100ms_ease-out] motion-safe:data-[state=closed]:animate-[scale-out_100ms_ease-in] p-[10px] text-(length:--ui-font-size-sm)/(--ui-font-line-height-reset) font-[family-name:var(--ui-font-family-primary)] bg-(--ui-color-bg-content-primary)/80 text-(--ui-color-design-plain-na-focused-content) rounded-[calc(var(--ui-border-radius-xl)-2px)] origin-(--reka-tooltip-content-transform-origin) pointer-events-auto',
arrow: 'fill-(--ui-color-bg-content-primary)/80',
text: 'text-pretty max-w-[200px] min-w-[100px]',
kbds: "hidden lg:inline-flex items-center shrink-0 gap-0.5 not-first-of-type:before:content-[''] not-first-of-type:before:me-0.5",
kbdsSize: 'sm',
kbdsAccent: 'default'
}
}
}
})
import { defineConfig } from 'vite'
import vue from '@vitejs/plugin-vue'
import bitrix24UIPluginVite from '@bitrix24/b24ui-nuxt/vite'
export default defineConfig({
plugins: [
vue(),
bitrix24UIPluginVite({
b24ui: {
tooltip: {
slots: {
content: 'dark flex flex-row items-center justify-between gap-[5px] will-change-[opacity] min-h-[37px] shadow-xl/20 select-none motion-safe:data-[state=delayed-open]:animate-[scale-in_100ms_ease-out] motion-safe:data-[state=closed]:animate-[scale-out_100ms_ease-in] p-[10px] text-(length:--ui-font-size-sm)/(--ui-font-line-height-reset) font-[family-name:var(--ui-font-family-primary)] bg-(--ui-color-bg-content-primary)/80 text-(--ui-color-design-plain-na-focused-content) rounded-[calc(var(--ui-border-radius-xl)-2px)] origin-(--reka-tooltip-content-transform-origin) pointer-events-auto',
arrow: 'fill-(--ui-color-bg-content-primary)/80',
text: 'text-pretty max-w-[200px] min-w-[100px]',
kbds: "hidden lg:inline-flex items-center shrink-0 gap-0.5 not-first-of-type:before:content-[''] not-first-of-type:before:me-0.5",
kbdsSize: 'sm',
kbdsAccent: 'default'
}
}
}
})
]
})