Skip to content

Shortcut Teaching Toast

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

Onboarding & CoachmarksHTMLCSSany framework
Pro tip

Press D for dark mode, any time.

Copy into your project

HTML
<!-- Shortcut Teaching Toast — teaches a keyboard shortcut with animated key chips -->
<div class="nuda-ob2-shortcut-toast" role="status" aria-live="polite">
  <div class="nuda-ob2-shortcut-toast__icon" aria-hidden="true">
    <svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round">
      <rect x="3" y="6" width="18" height="12" rx="2" />
      <path d="M7 10 L7 10.01 M11 10 L11 10.01 M15 10 L15 10.01 M8 14 L16 14" />
    </svg>
  </div>
  <div class="nuda-ob2-shortcut-toast__body">
    <span class="nuda-ob2-shortcut-toast__label">Pro tip</span>
    <p>Press <kbd class="nuda-ob2-shortcut-toast__key">⇧</kbd><kbd class="nuda-ob2-shortcut-toast__key">D</kbd> for dark mode, any time.</p>
  </div>
  <button class="nuda-ob2-shortcut-toast__close" type="button" aria-label="Dismiss">
    <svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round">
      <path d="M6 6 L18 18 M18 6 L6 18" />
    </svg>
  </button>
</div>
CSS
.nuda-ob2-shortcut-toast {
  position: relative;
  display: flex;
  align-items: flex-start;
  gap: 10px;
  width: 100%;
  max-width: 300px;
  padding: 12px 14px;
  background: rgba(20,20,24,.97);
  border: 1px solid rgba(255,255,255,.1);
  border-radius: 12px;
  box-shadow: 0 20px 44px -12px rgba(0,0,0,.6);
  animation: nuda-ob2-shortcut-toast-in .45s cubic-bezier(.34,1.56,.64,1);
}

.nuda-ob2-shortcut-toast__icon {
  width: 28px;
  height: 28px;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(228,255,84,.12);
  border: 1px solid rgba(228,255,84,.3);
  border-radius: 8px;
  color: #e4ff54;
}

.nuda-ob2-shortcut-toast__icon svg {
  width: 15px;
  height: 15px;
}

.nuda-ob2-shortcut-toast__body {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.nuda-ob2-shortcut-toast__label {
  font: 800 10px ui-sans-serif,system-ui;
  color: #e4ff54;
  text-transform: uppercase;
  letter-spacing: .08em;
}

.nuda-ob2-shortcut-toast__body p {
  margin: 0;
  font: 500 12px/1.5 ui-sans-serif,system-ui;
  color: #cfcfcf;
}

.nuda-ob2-shortcut-toast__key {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 18px;
  height: 18px;
  padding: 0 4px;
  margin: 0 1px;
  background: rgba(255,255,255,.08);
  border: 1px solid rgba(255,255,255,.16);
  border-radius: 4px;
  font: 700 10px ui-monospace,monospace;
  color: #fafafa;
  animation: nuda-ob2-shortcut-toast-key 2.4s ease-in-out infinite;
}

.nuda-ob2-shortcut-toast__key:nth-of-type(2) {
  animation-delay: .15s;
}

.nuda-ob2-shortcut-toast__close {
  position: relative;
  width: 18px;
  height: 18px;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background: transparent;
  border: none;
  color: #777;
  cursor: pointer;
  border-radius: 5px;
}

.nuda-ob2-shortcut-toast__close::before {
  content: "";
  position: absolute;
  inset: -13px;
}

.nuda-ob2-shortcut-toast__close:hover {
  color: #fafafa;
}

.nuda-ob2-shortcut-toast__close:focus-visible {
  outline: 2px solid #e4ff54;
  outline-offset: 2px;
}

.nuda-ob2-shortcut-toast__close svg {
  width: 11px;
  height: 11px;
}

@keyframes nuda-ob2-shortcut-toast-in {
  from {
    opacity: 0;
    transform: translateY(14px) scale(.96);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

@keyframes nuda-ob2-shortcut-toast-key {
  0%,100% {
    transform: translateY(0);
  }
  50% {
    transform: translateY(-2px);
  }
}

@media (prefers-reduced-motion:reduce) {
  .nuda-ob2-shortcut-toast {
    animation: none;
  }
  .nuda-ob2-shortcut-toast__key {
    animation: none;
  }
}

How to use Shortcut Teaching Toast

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 onboarding & coachmarks components

← Browse all NudaUI components