summaryrefslogtreecommitdiffhomepage
path: root/packages/ui/src/components/tooltip.tsx
diff options
context:
space:
mode:
Diffstat (limited to 'packages/ui/src/components/tooltip.tsx')
-rw-r--r--packages/ui/src/components/tooltip.tsx20
1 files changed, 20 insertions, 0 deletions
diff --git a/packages/ui/src/components/tooltip.tsx b/packages/ui/src/components/tooltip.tsx
index b3a2b628f..c38ee5847 100644
--- a/packages/ui/src/components/tooltip.tsx
+++ b/packages/ui/src/components/tooltip.tsx
@@ -8,6 +8,26 @@ export interface TooltipProps extends ComponentProps<typeof KobalteTooltip> {
inactive?: boolean
}
+export interface TooltipKeybindProps extends Omit<TooltipProps, "value"> {
+ title: string
+ keybind: string
+}
+
+export function TooltipKeybind(props: TooltipKeybindProps) {
+ const [local, others] = splitProps(props, ["title", "keybind"])
+ return (
+ <Tooltip
+ {...others}
+ value={
+ <div data-slot="tooltip-keybind">
+ <span>{local.title}</span>
+ <span data-slot="tooltip-keybind-key">{local.keybind}</span>
+ </div>
+ }
+ />
+ )
+}
+
export function Tooltip(props: TooltipProps) {
const [open, setOpen] = createSignal(false)
const [local, others] = splitProps(props, ["children", "class", "inactive"])