Skip to content

Typewriter Tip

A copy-paste tooltips component in pure HTML & CSS. Zero dependencies, framework-agnostic, MIT-licensed.

TooltipsHTMLCSSany framework

Copy into your project

HTML
<div class="nuda-typetip-wrap">
  <button class="nuda-typetip__trigger" aria-describedby="typetip-tip-1">
    Hover me
  </button>
  <div class="nuda-typetip" role="tooltip" id="typetip-tip-1">
    <span class="nuda-typetip__text">Typed on hover</span>
  </div>
</div>
CSS
/* Typewriter Tip
   Tooltip text types itself in with a blinking caret via steps().
   Shows on hover and keyboard focus.
   Customize: --typetip-accent; set max-width to your text length in ch. */

.nuda-typetip-wrap {
  position: relative;
  display: inline-block;
}

.nuda-typetip__trigger {
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.12);
  color: #ccc;
  padding: 0.45rem 1rem;
  border-radius: 8px;
  font-size: 0.85rem;
  cursor: pointer;
}

.nuda-typetip {
  --typetip-accent: #e4ff54;
  position: absolute;
  bottom: calc(100% + 8px);
  left: 50%;
  transform: translateX(-50%);
  background: #0c0c10;
  border: 1px solid rgba(228, 255, 84, 0.2);
  color: var(--typetip-accent);
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 0.72rem;
  padding: 0.4rem 0.7rem;
  border-radius: 6px;
  white-space: nowrap;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.15s ease;
}

.nuda-typetip__text {
  display: inline-block;
  overflow: hidden;
  white-space: nowrap;
  vertical-align: bottom;
  border-right: 2px solid var(--typetip-accent);
  max-width: 0;
}

.nuda-typetip-wrap:hover .nuda-typetip,
.nuda-typetip__trigger:focus-visible + .nuda-typetip {
  opacity: 1;
}

.nuda-typetip-wrap:hover .nuda-typetip__text,
.nuda-typetip__trigger:focus-visible + .nuda-typetip .nuda-typetip__text {
  animation:
    nuda-typetip-type 1.1s steps(14) forwards,
    nuda-typetip-caret 0.7s step-end infinite;
}

@keyframes nuda-typetip-type {
  from { max-width: 0; }
  to   { max-width: 14ch; }
}

@keyframes nuda-typetip-caret {
  0%, 100% { border-color: var(--typetip-accent); }
  50%      { border-color: transparent; }
}

@media (prefers-reduced-motion: reduce) {
  .nuda-typetip { transition: none; }
  .nuda-typetip-wrap:hover .nuda-typetip__text,
  .nuda-typetip__trigger:focus-visible + .nuda-typetip .nuda-typetip__text {
    animation: none;
    max-width: 14ch;
    border-right-color: transparent;
  }
}

How to use Typewriter Tip

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.

More tooltips components

← Browse all NudaUI components