A static line of text followed by a block cursor that blinks, as at a terminal prompt. Pairs with any typing effect, or stands alone as a 'waiting for input' cue.
Also known as: terminal prompt, command line cursor.
<div class="txt-blinking-cursor-text">$ npm run build<span aria-hidden="true"></span></div>
.txt-blinking-cursor-text {
--c: var(--txt-color, #3b82f6);
font-size: var(--txt-size, 32px);
font-family: system-ui, sans-serif;
font-weight: 700;
line-height: 1.2;
font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
font-weight: 500;
color: var(--c);}
.txt-blinking-cursor-text span {
display: inline-block;
width: 0.55em;
height: 1em;
margin-left: 0.15em;
vertical-align: text-bottom;
background: var(--c);
animation: txt-blinking-cursor-text-blink 1s steps(2, start) infinite;
}
@keyframes txt-blinking-cursor-text-blink {
to { visibility: hidden; }
}
@media (prefers-reduced-motion: reduce) {
.txt-blinking-cursor-text, .txt-blinking-cursor-text *, .txt-blinking-cursor-text::before, .txt-blinking-cursor-text::after {
animation-duration: 0.01ms !important;
animation-iteration-count: 1 !important;
transition-duration: 0.01ms !important;
}
}--txt-color on the element or a parent.
Currently previewing #3b82f6.--txt-size. Every other dimension is in
em, so the whole thing scales together. Currently previewing 40px.transition or animation
shorthand. Staggered delays are relative, so they keep their rhythm.