/Click feedback
Click feedback • CSS
Gradient Underline Button
A label that scales up as a warm gradient underline grows across it.
Installation
Terminal
npx shadcn@latest add https://microkit.co/r/gradient-underline-button.jsonCode
TypeScript component
1export function GradientUnderlineButton() {2return (3<button type="button" className="gradient-underline-button">4<span className="gradient-underline-button-label">HOVER ME</span>5<span className="gradient-underline-button-line" aria-hidden="true" />6</button>7);8}
CSS
1.gradient-underline-button {2appearance: none;3position: relative;4display: inline-flex;5flex-direction: column;6align-items: center;7justify-content: center;8overflow: hidden;9border: 0;10background: transparent;11padding: 8px 24px;12color: #f0f0f0;13font-family: Arial, Helvetica, sans-serif;14cursor: pointer;15}16.gradient-underline-button-label {17position: relative;18z-index: 1;19font-size: 16px;20font-weight: 500;21transition: transform .5s ease;22}23.gradient-underline-button-line {24position: absolute;25right: auto;26bottom: 0;27left: 0;28width: 0;29height: 1px;30background: linear-gradient(90deg, transparent 0%, rgba(249, 115, 22, .35) 30%, #f97316 50%, rgba(249, 115, 22, .35) 70%, transparent 100%);31transition: width 1s cubic-bezier(.165, .84, .44, 1);32}33.gradient-underline-button:hover .gradient-underline-button-label,34.gradient-underline-button:focus-visible .gradient-underline-button-label {35transform: scale(1.2);36}37.gradient-underline-button:hover .gradient-underline-button-line,38.gradient-underline-button:focus-visible .gradient-underline-button-line {39width: 100%;40}41.gradient-underline-button:focus-visible {42outline: 2px solid #f97316;43outline-offset: 4px;44}