Typing Code
A copy-paste code & terminal component in pure HTML & CSS. Zero dependencies, framework-agnostic, MIT-licensed.
Code & TerminalHTMLCSSany framework
const app = create()Copy into your project
HTML
<!-- Typing Code — token-colored line with typing reveal -->
<pre class="nuda-typer"><code><span class="nuda-typer__a">const</span> <span class="nuda-typer__b">app</span> = <span class="nuda-typer__c">create</span>()</code><span class="nuda-typer__caret"></span></pre>CSS
/* Typing Code
Single line that "types" via steps() and a blinking caret.
Customize: --ty-bg, token colors. */
.nuda-typer {
--ty-bg: #0a0a0a;
margin: 0;
padding: 12px 14px;
background: var(--ty-bg);
border: 1px solid rgba(255, 255, 255, 0.08);
border-radius: 8px;
font: 500 0.95rem ui-monospace, monospace;
color: #fafafa;
width: 100%;
max-width: 480px;
overflow: hidden;
white-space: nowrap;
display: flex;
align-items: center;
}
.nuda-typer code {
display: inline-block;
overflow: hidden;
/* Adjust steps(N) to match the number of characters in your code line. */
animation: nuda-ty-type 3s steps(28) infinite;
}
.nuda-typer__a { color: #a78bfa; }
.nuda-typer__b { color: #fbbf24; }
.nuda-typer__c { color: #e4ff54; }
.nuda-typer__caret {
display: inline-block;
width: 1.5px;
height: 1em;
background: #e4ff54;
margin-left: 2px;
animation: nuda-ty-blink 1s steps(2) infinite;
}
@keyframes nuda-ty-type {
0% { width: 0; }
80%, 100% { width: 100%; }
}
@keyframes nuda-ty-blink { 50% { opacity: 0; } }
@media (prefers-reduced-motion: reduce) {
.nuda-typer code,
.nuda-typer__caret { animation: none; }
}How to use Typing Code
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.