summaryrefslogtreecommitdiffhomepage
path: root/packages/ui/src
diff options
context:
space:
mode:
authorAdam <[email protected]>2025-12-31 11:24:45 -0600
committerAdam <[email protected]>2025-12-31 13:12:29 -0600
commit3a1cfa6c731bc4c33348034cb918b7a4dbe2af8b (patch)
tree48bb1174aaa7e7b8c0b9b7a69219e6c4a2338a3a /packages/ui/src
parenta2857bba8305976761c55fda269d7fb79c951b8c (diff)
downloadopencode-3a1cfa6c731bc4c33348034cb918b7a4dbe2af8b.tar.gz
opencode-3a1cfa6c731bc4c33348034cb918b7a4dbe2af8b.zip
chore(app): keybind tooltip component
Diffstat (limited to 'packages/ui/src')
-rw-r--r--packages/ui/src/components/tooltip.css13
-rw-r--r--packages/ui/src/components/tooltip.tsx20
2 files changed, 33 insertions, 0 deletions
diff --git a/packages/ui/src/components/tooltip.css b/packages/ui/src/components/tooltip.css
index f7afe16aa..134de6f51 100644
--- a/packages/ui/src/components/tooltip.css
+++ b/packages/ui/src/components/tooltip.css
@@ -2,6 +2,19 @@
display: flex;
}
+[data-slot="tooltip-keybind"] {
+ display: flex;
+ align-items: center;
+ gap: 8px;
+}
+
+[data-slot="tooltip-keybind-key"] {
+ color: var(--icon-base);
+ font-size: var(--font-size-small);
+ font-weight: var(--font-weight-medium);
+ line-height: var(--line-height-large);
+}
+
[data-component="tooltip"] {
z-index: 1000;
max-width: 320px;
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"])