A quick horizontal shake, the universal 'no' for a wrong password or invalid form field. Plays once here; in your app, add the class when validation fails.
Also known as: error shake, wrong password shake, vibrate text.
<div class="txt-shake">Incorrect password</div>
.txt-shake {
--c: var(--txt-color, #3b82f6);
font-size: var(--txt-size, 32px);
font-family: system-ui, sans-serif;
font-weight: 700;
line-height: 1.2;
display: inline-block;
color: #dc2626;
font-weight: 600;
animation: txt-shake-no 0.5s ease-in-out;}
@keyframes txt-shake-no {
0%, 100% { transform: translateX(0); }
20%, 60% { transform: translateX(-0.25em); }
40%, 80% { transform: translateX(0.25em); }
}
@media (prefers-reduced-motion: reduce) {
.txt-shake, .txt-shake *, .txt-shake::before, .txt-shake::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.