Skip to content

REPL Session

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

Code & TerminalHTMLCSSany framework
>>> 6 * 7
42
>>> [x for x in range(3)]
[0, 1, 2]
>>>

Copy into your project

HTML
<!-- REPL Session — evaluated results reveal via clip-path after each input line, live prompt blinks -->
<div class="nuda-ct2-repl">
  <div class="nuda-ct2-repl__pair">
    <div class="nuda-ct2-repl__in"><span class="nuda-ct2-repl__prompt">&gt;&gt;&gt;</span> 6 * 7</div>
    <div class="nuda-ct2-repl__out" style="--d: .3s">42</div>
  </div>
  <div class="nuda-ct2-repl__pair">
    <div class="nuda-ct2-repl__in"><span class="nuda-ct2-repl__prompt">&gt;&gt;&gt;</span> [x for x in range(3)]</div>
    <div class="nuda-ct2-repl__out" style="--d: .6s">[0, 1, 2]</div>
  </div>
  <div class="nuda-ct2-repl__in nuda-ct2-repl__in--live">
    <span class="nuda-ct2-repl__prompt">&gt;&gt;&gt;</span> <span class="nuda-ct2-repl__caret"></span>
  </div>
</div>
CSS
.nuda-ct2-repl {
  width: 280px;
  background: #09090b;
  border: 1px solid rgba(255,255,255,.08);
  border-radius: 8px;
  padding: 11px 13px;
  font: 500 11px ui-monospace,SFMono-Regular,Menlo,monospace;
  color: #fafafa;
  display: flex;
  flex-direction: column;
  gap: 5px;
}

.nuda-ct2-repl__pair {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.nuda-ct2-repl__in {
  color: #cfcfcf;
}

.nuda-ct2-repl__prompt {
  color: #a78bfa;
  font-weight: 700;
  margin-right: 4px;
}

.nuda-ct2-repl__out {
  color: #e4ff54;
  padding-left: 16px;
  overflow: hidden;
  clip-path: inset(0 100% 0 0);
  animation: _nuda-ct2replreveal .4s steps(12) var(--d,0s) forwards;
}

.nuda-ct2-repl__caret {
  display: inline-block;
  width: 6px;
  height: 11px;
  background: #e4ff54;
  vertical-align: -2px;
  animation: _nuda-ct2replblink 1s steps(2) infinite;
  animation-delay: 1s;
}

@keyframes _nuda-ct2replreveal {
  to {
    clip-path: inset(0 0 0 0);
  }
}

@keyframes _nuda-ct2replblink {
  50% {
    opacity: 0;
  }
}

@media (prefers-reduced-motion:reduce) {
  .nuda-ct2-repl__out {
    animation: none;
    clip-path: inset(0 0 0 0);
  }
  .nuda-ct2-repl__caret {
    animation: none;
  }
}

How to use REPL Session

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 code & terminal components

← Browse all NudaUI components