/Click feedback
Click feedback • CSS
Yellow Fill Preview Button
An outlined Preview in browser button that fills with yellow from the left.
Installation
Terminal
npx shadcn@latest add https://microkit.co/r/yellow-fill-preview-button.jsonCode
TypeScript component
1export function YellowFillPreviewButton() {2return (3<button type="button" className="yellow-fill-preview-button">4<span className="yellow-fill-preview-button-label">Preview in browser</span>5<span className="yellow-fill-preview-button-fill" aria-hidden="true" />6</button>7);8}
CSS
1.yellow-fill-preview-button {2appearance: none;3position: relative;4display: inline-flex;5align-items: center;6justify-content: center;7overflow: hidden;8border: 1px solid #f0f0f0;9border-radius: 999px;10background: transparent;11padding: 12px 24px;12color: #f0f0f0;13font-family: Arial, Helvetica, sans-serif;14cursor: pointer;15}16.yellow-fill-preview-button-label {17position: relative;18z-index: 1;19font-size: 16px;20font-weight: 500;21transition: color .3s ease;22}23.yellow-fill-preview-button-fill {24position: absolute;25top: 0;26bottom: 0;27left: 0;28width: 0;29background: #f97316;30transition: width .5s cubic-bezier(.16, 1, .3, 1);31}32.yellow-fill-preview-button:hover .yellow-fill-preview-button-label,33.yellow-fill-preview-button:focus-visible .yellow-fill-preview-button-label {34color: #111;35}36.yellow-fill-preview-button:hover .yellow-fill-preview-button-fill,37.yellow-fill-preview-button:focus-visible .yellow-fill-preview-button-fill {38width: 100%;39}40.yellow-fill-preview-button:focus-visible {41outline: 2px solid #f97316;42outline-offset: 4px;43}