Keyboard Shortcut Tooltip
A copy-paste tooltips component in pure HTML & CSS. Zero dependencies, framework-agnostic, MIT-licensed.
TooltipsHTMLCSSany framework
Save document⌘S
Copy into your project
HTML
<div class="nuda-kbdtt-wrap">
<button class="nuda-kbdtt-trigger">Save</button>
<div class="nuda-kbdtt">
Save document
<span class="nuda-kbdtt__keys">
<kbd>⌘</kbd>
<kbd>S</kbd>
</span>
</div>
</div>CSS
.nuda-kbdtt-wrap {
position: relative;
display: inline-block;
}
.nuda-kbdtt-trigger {
padding: 6px 12px;
background: rgba(255,255,255,.04);
border: 1px solid rgba(255,255,255,.08);
color: #fafafa;
border-radius: 8px;
font-size: 12px;
cursor: pointer;
transition: background .25s;
}
.nuda-kbdtt-wrap:hover .nuda-kbdtt-trigger {
background: rgba(255,255,255,.07);
}
.nuda-kbdtt {
position: absolute;
left: 50%;
bottom: calc(100% + 8px);
transform: translateX(-50%) translateY(4px);
display: inline-flex;
align-items: center;
gap: 10px;
padding: 6px 10px;
background: #09090b;
border: 1px solid rgba(255,255,255,.1);
border-radius: 7px;
color: #fafafa;
font-size: 11px;
white-space: nowrap;
opacity: 0;
pointer-events: none;
transition: opacity .25s,transform .35s cubic-bezier(.16,1,.3,1);
z-index: 10;
}
.nuda-kbdtt-wrap:hover .nuda-kbdtt {
opacity: 1;
transform: translateX(-50%) translateY(0);
pointer-events: auto;
}
.nuda-kbdtt__keys {
display: inline-flex;
gap: 3px;
}
.nuda-kbdtt__keys kbd {
display: inline-flex;
align-items: center;
justify-content: center;
min-width: 18px;
height: 16px;
padding: 0 4px;
background: rgba(255,255,255,.06);
border: 1px solid rgba(255,255,255,.1);
border-radius: 4px;
font-family: ui-monospace,SFMono-Regular,Menlo,monospace;
font-size: 10px;
color: #a0a0a8;
box-shadow: inset 0 -1px 0 rgba(0,0,0,.3);
}
How to use Keyboard Shortcut Tooltip
Paste the HTML where you need it and the CSS into a global stylesheet (or a <style> tag). Every class is prefixed nuda- so it never collides with Tailwind or your own styles. Tweak the CSS custom properties to match your design system.
Works in React, Vue, Svelte, Astro, Next.js, Nuxt, Laravel Blade, Django, Rails — or a single .html file. No npm install, no build step.