Skip to content

Instantly share code, notes, and snippets.

@pebueno
Created February 27, 2024 14:42
Show Gist options
  • Save pebueno/5eccb691e90f6cb67dc33a8075ff3772 to your computer and use it in GitHub Desktop.
Save pebueno/5eccb691e90f6cb67dc33a8075ff3772 to your computer and use it in GitHub Desktop.
Button Gradient Roll on Hover
// Implement animation for gradient on hover
const Component = () => {
return (
<div className="container">
<button>BUTTON</button>
</div>
)
}
ReactDOM.render(<Component />, document.querySelector("#app"))
.container {
width: 300px;
}
button {
margin: 50px;
width: 300px;
height: 50px;
border-radius: 20px;
border: none;
outline: none;
background-size: 300% 100%;
background-image: linear-gradient(to right, #25aae1, #4481eb, #04befe, #3f86ed);
transition: all 0.4s ease-in-out;
}
button:hover {
background-position: 100% 0;
transition: all 0.4s ease-in-out;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment