mirror of
https://github.com/ArthurDanjou/ui.git
synced 2026-01-18 22:11:43 +01:00
chore(Tooltip): improve slots
This commit is contained in:
@@ -25,6 +25,8 @@ export interface TooltipEmits extends TooltipRootEmits {}
|
||||
export interface TooltipSlots {
|
||||
default(): any
|
||||
content(): any
|
||||
text(): any
|
||||
shortcuts(): any
|
||||
}
|
||||
</script>
|
||||
|
||||
@@ -55,10 +57,14 @@ const ui = computed(() => tv({ extend: tooltip, slots: props.ui })())
|
||||
<TooltipPortal :disabled="!portal">
|
||||
<TooltipContent v-bind="contentProps" :class="ui.content({ class: props.class })">
|
||||
<slot name="content">
|
||||
<span :class="ui.text()">{{ text }}</span>
|
||||
<span v-if="text" :class="ui.text()">
|
||||
<slot name="text">{{ text }}</slot>
|
||||
</span>
|
||||
|
||||
<span v-if="shortcuts?.length" :class="ui.shortcuts()">
|
||||
<UKbd v-for="(shortcut, index) in shortcuts" :key="index" size="xs" v-bind="typeof shortcut === 'string' ? { value: shortcut } : shortcut" />
|
||||
<slot name="shortcuts">
|
||||
<UKbd v-for="(shortcut, index) in shortcuts" :key="index" size="xs" v-bind="typeof shortcut === 'string' ? { value: shortcut } : shortcut" />
|
||||
</slot>
|
||||
</span>
|
||||
</slot>
|
||||
|
||||
|
||||
Reference in New Issue
Block a user