Collection of free HTML button with vanilla JavaScript code examples: animated, multiple, confirm, delete, download/upload, submit and with hover/click/hold effects

Welcome to our collection of JavaScript examples! In this meticulously curated compilation, we have assembled a diverse range of JavaScript code snippets that showcase the flexibility and power of this dynamic programming language.

Add to Card - Micro Interaction

Author:
Orhan Eroğlu | April 10, 2021
Made with:
HTML / CSS / JS

Compatible browsers:
Chrome, Edge, Firefox, Opera, Safari
Responsive:
yes
Dependencies:
-

Click to Send

Author:
Dilum | April 9, 2021
Made with:
HTML / CSS / JS

Compatible browsers:
Chrome, Edge, Firefox, Opera, Safari
Responsive:
yes
Dependencies:
gsap.js

Button

Author:
@BrawadaCom | April 9, 2021
Made with:
HTML (Slim) / CSS (Sass) / JS

Compatible browsers:
Chrome, Edge, Firefox, Opera, Safari
Responsive:
yes
Dependencies:
-

Click Button

Author:
Zarko Rvovic | April 8, 2021
Made with:
HTML / CSS (SCSS) / JS

Compatible browsers:
Chrome, Edge, Firefox, Opera, Safari
Responsive:
yes
Dependencies:
gsap.js

Button

Author:
@BrawadaCom | April 5, 2021
Made with:
HTML (Slim) / CSS (Sass) / JS

Compatible browsers:
Chrome, Edge, Firefox, Opera, Safari
Responsive:
yes
Dependencies:
-

DevTo Button

Author:
Jhey | March 18, 2021
Made with:
HTML (Pug) / CSS (Stylus) / JS (Babel)

Compatible browsers:
Chrome, Edge, Firefox, Opera, Safari
Responsive:
yes
Dependencies:
-

Wavy Hover Button

Author:
Tom Miller | February 22, 2021
Made with:
HTML / CSS / JS

Compatible browsers:
Chrome, Edge, Firefox, Opera, Safari
Responsive:
yes
Dependencies:
zepto.js, gsap.js

Bear Five Like Button

Author:
Jhey | February 9, 2021
Made with:
HTML / CSS (Stylus) / JS (Babel)

Compatible browsers:
Chrome, Edge, Firefox, Opera, Safari
Responsive:
yes
Dependencies:
gsap.js

3D Pause Button

Author:
Håvard Brynjulfsen | January 12, 2021
Made with:
HTML / CSS (SCSS) / JS

Compatible browsers:
Chrome, Edge, Firefox, Opera, Safari
Responsive:
yes
Dependencies:
-

Magnetic Button Animation

Author:
Milan Raring | December 22, 2020
Made with:
HTML / CSS (SCSS) / JS

Compatible browsers:
Chrome, Edge, Firefox, Opera, Safari
Responsive:
yes
Dependencies:
-

Add to Cart Button

Author:
Aaron Iker | November 20, 2020
Made with:
HTML / CSS (SCSS) / JS

Compatible browsers:
Chrome, Edge, Firefox, Opera, Safari
Responsive:
yes
Dependencies:
gsap.js

Pay Button

Author:
Aaron Iker | November 2, 2020
Made with:
HTML / CSS (SCSS) / JS

Compatible browsers:
Chrome, Edge, Firefox, Opera, Safari
Responsive:
yes
Dependencies:
gsap.js

Coin Flip Donate Button

Author:
Cooper Goeke | October 28, 2020
Made with:
HTML / CSS (SCSS) / JS

About a code

A simple idea that ended up being really hard to pull off. No 3D elements or transformations are used in this experiment, only 2D elements and some clever math to give the illusion of a 3D coin with real thickness. The coin flipping is actually randomized too - if you press the button a few times you'll see.

Compatible browsers:
Chrome, Edge, Firefox, Opera, Safari
Responsive:
yes
Dependencies:
-

Corsair Magnetic Button

Author:
Dennis | October 8, 2020
Made with:
HTML / CSS / JS

Compatible browsers:
Chrome, Edge, Firefox, Opera, Safari
Responsive:
yes
Dependencies:
-

Floating Button

Author:
Yury | October 2, 2020
Made with:
HTML / CSS / JS

Compatible browsers:
Chrome, Edge, Firefox, Opera, Safari
Responsive:
yes
Dependencies:
-

Unsubscribe Buttons

Author:
Cooper Goeke | September 28, 2020
Made with:
HTML / CSS (SCSS) / JS

About a code

Some ridiculous unsubscribe buttons designed to make the user feel bad for unsubscribing - not seriously though. This project leans heavily on SVG's and CSS animations and no external libraries are used.

Compatible browsers:
Chrome, Edge, Firefox, Opera, Safari
Responsive:
yes
Dependencies:
-

Don't Let The Door Hit You On The Way Out

Author:
Cooper Goeke | September 21, 2020
Made with:
HTML / CSS (SCSS) / JS

About a code

This pen features some heavy use of CSS variables and transitions on SVG elements. Animating all the figure's limbs is tedious work but it pays off when you see the finished product.

Compatible browsers:
Chrome, Edge, Firefox, Opera, Safari
Responsive:
yes
Dependencies:
-

Neumorphism - Wave Animation

Author:
Guilmain Dorian | September 19, 2020
Made with:
HTML (Pug) / CSS (SCSS) / JS

Compatible browsers:
Chrome, Edge, Firefox, Opera, Safari
Responsive:
yes
Dependencies:
-

Scroll to Top Button with Vanilla JS

Author:
Marcel Rojas | September 18, 2020
Made with:
HTML / CSS / JS

Compatible browsers:
Chrome, Edge, Firefox, Opera, Safari
Responsive:
yes
Dependencies:
-

Like Button

Author:
Jhey | September 17, 2020
Made with:
HTML / CSS (Stylus) / JS (Babel)

Compatible browsers:
Chrome, Edge, Firefox, Opera, Safari
Responsive:
yes
Dependencies:
gsap.js

Button Loading

Author:
inspirecoding | September 14, 2020
Made with:
HTML / CSS / JS

Compatible browsers:
Chrome, Edge, Firefox, Opera, Safari
Responsive:
yes
Dependencies:
boxicons.css

Scroll Triggered Flip. Floating Action Button Transition

Author:
@keyframers | September 14, 2020
Made with:
HTML / CSS (SCSS) / JS

Compatible browsers:
Chrome, Edge, Firefox, Opera, Safari
Responsive:
yes
Dependencies:
-

Super Fun Buttons

Author:
Wes Bos | September 4, 2020
Made with:
HTML / CSS / JS (Babel)

Compatible browsers:
Chrome, Edge, Firefox, Opera, Safari
Responsive:
no
Dependencies:
-

Button Interaction (GSAP)

Author:
Faria Begum Riya | August 28, 2020
Made with:
HTML / CSS (Less) / JS (Babel)

Compatible browsers:
Chrome, Edge, Firefox, Opera, Safari
Responsive:
yes
Dependencies:
gsap.js

The Animated Share Button Using HTML, CSS & JS

Author:
Coding Beast | August 25, 2020
Made with:
HTML / CSS (SCSS) / JS

Compatible browsers:
Chrome, Edge, Firefox, Opera, Safari
Responsive:
yes
Dependencies:
-

Like Animation

Author:
Tamino Martinius | August 24, 2020
Made with:
HTML / CSS (SCSS) / JS (TypeScript)

Compatible browsers:
Chrome, Edge, Firefox, Opera, Safari
Responsive:
yes
Dependencies:
-

Love Button

Author:
Jhey | August 14, 2020
Made with:
HTML (Pug) / CSS (Stylus) / JS (Babel)

Compatible browsers:
Chrome, Edge, Firefox, Opera, Safari
Responsive:
yes
Dependencies:
-

Button Ripple Effect (Material Design)

Author:
dazar | August 13, 2020
Made with:
HTML / CSS (SCSS) / JS (TypeScript)

Compatible browsers:
Chrome, Edge, Firefox, Opera, Safari
Responsive:
yes
Dependencies:
-

Favorite Button

Author:
Aaron Iker | August 13, 2020
Made with:
HTML / CSS (SCSS) / JS

Compatible browsers:
Chrome, Edge, Firefox, Opera, Safari
Responsive:
yes
Dependencies:
gsap.js

Shiny Buttons

Author:
Sil van Diepen | August 11, 2020
Made with:
HTML (Pug) / CSS (SCSS) / JS

Compatible browsers:
Chrome, Edge, Firefox, Opera, Safari
Responsive:
yes
Dependencies:
-

Magnetic Buttons

Author:
Mary Lou | August 5, 2020
Made with:
HTML / CSS / JS

About a code

A small set of magnetic buttons with some fun hover animations.

Compatible browsers:
Chrome, Edge, Firefox, Opera, Safari
Responsive:
yes
Dependencies:
-

Like Animation

Author:
Tamino Martinius | August 5, 2020
Made with:
HTML / CSS (SCSS) / JS (TypeScript)

Compatible browsers:
Chrome, Edge, Firefox, Opera, Safari
Responsive:
yes
Dependencies:
gsap.js

Download Animation

Author:
Aaron Iker | August 5, 2020
Made with:
HTML / CSS (SCSS) / JS

Compatible browsers:
Chrome, Edge, Firefox, Opera, Safari
Responsive:
yes
Dependencies:
gsap.js

Like Button

Author:
Tamino Martinius | July 31, 2020
Made with:
HTML / CSS (SCSS) / JS (Babel)

Compatible browsers:
Chrome, Edge, Firefox, Opera, Safari
Responsive:
yes
Dependencies:
gsap.js

Add to Cart

Author:
Aaron Iker | July 21, 2020
Made with:
HTML / CSS (SCSS) / JS

Compatible browsers:
Chrome, Edge, Firefox, Opera, Safari
Responsive:
yes
Dependencies:
-

Upload Progress Animation Microinteraction with GSAP

Author:
Takane Ichinose | July 20, 2020
Made with:
HTML / CSS / JS

About a code

On the first click, the shape of the button will become circle. Then, the button will become a progress bar, and a "speech bubble" above the progress bar will be shown. That "speech bubble" shows the percentage of the upload progress. The "speech bubble" will tilt when the progress starts. After the uploading is done, the button will turn into green colored circle, then the check mark will appear, pertaining that the upload is already done. After 5 seconds, the button will return into its normal state.

Compatible browsers:
Chrome, Edge, Firefox, Opera, Safari
Responsive:
yes
Dependencies:
gsap.js

I ❤️ This

Author:
David Kerns | July 15, 2020
Made with:
HTML / CSS (SCSS) / JS

Compatible browsers:
Chrome, Edge, Firefox, Opera, Safari
Responsive:
yes
Dependencies:
tailwind.css, alpine.js

Bookmark

Author:
Aaron Iker | July 9, 2020
Made with:
HTML / CSS (SCSS) / JS

Compatible browsers:
Chrome, Edge, Firefox, Opera, Safari
Responsive:
yes
Dependencies:
gsap.js

Download Button

Author:
Aaron Iker | July 2, 2020
Made with:
HTML / CSS (SCSS) / JS

Compatible browsers:
Chrome, Edge, Firefox, Opera, Safari
Responsive:
yes
Dependencies:
gsap.js

Shuffle Buttons

Author:
Chris Gannon | June 21, 2020
Made with:
HTML / CSS / JS

Compatible browsers:
Chrome, Edge, Firefox, Opera, Safari
Responsive:
yes
Dependencies:
gsap.js

Morphing Icon Download Button

Author:
Jon Kantner | June 9, 2020
Made with:
HTML / CSS / JS

About a code

A download animation where the arrow and tray merge into a progress bar that will soon become a checkmark.

Compatible browsers:
Chrome, Edge, Firefox, Opera, Safari
Responsive:
yes
Dependencies:
-

GSAP Like Button

Author:
Shunya Koide | June 8, 2020
Made with:
HTML / CSS / JS

Compatible browsers:
Chrome, Edge, Firefox, Opera, Safari
Responsive:
yes
Dependencies:
gsap.js

Drag to Confirm

Author:
Aaron Iker | June 8, 2020
Made with:
HTML / CSS (SCSS) / JS

Compatible browsers:
Chrome, Edge, Firefox, Opera, Safari
Responsive:
yes
Dependencies:
gsap.js

GSAP Send Button Animation

Author:
Shahid Shaikh | June 6, 2020
Made with:
HTML / CSS (SCSS) / JS

About a code

Button animation using GSAP animation library.

Compatible browsers:
Chrome, Edge, Firefox, Opera, Safari
Responsive:
yes
Dependencies:
gsap.js

Send Button

Author:
Adebisi Ahmed | June 3, 2020
Made with:
HTML / CSS (SCSS) / JS

Compatible browsers:
Chrome, Edge, Firefox, Opera, Safari
Responsive:
yes
Dependencies:
-

Paper Plane Button

Author:
Aaron Iker | June 3, 2020
Made with:
HTML / CSS (SCSS) / JS

Compatible browsers:
Chrome, Edge, Firefox, Opera, Safari
Responsive:
yes
Dependencies:
gsap.js

Soft Ripple Interaction

Author:
Sikriti Dakua | June 3, 2020
Made with:
HTML / CSS (SCSS) / JS

Compatible browsers:
Chrome, Edge, Firefox, Opera, Safari
Responsive:
yes
Dependencies:
softripple.js

Paper Plane Button

Author:
Aaron Iker | May 29, 2020
Made with:
HTML / CSS (SCSS) / JS

Compatible browsers:
Chrome, Edge, Firefox, Opera, Safari
Responsive:
yes
Dependencies:
gsap.js

Magnetic Hover Interaction

Author:
Sikriti Dakua | May 23, 2020
Made with:
HTML / CSS (SCSS) / JS

Compatible browsers:
Chrome, Edge, Firefox, Opera, Safari
Responsive:
yes
Dependencies:
font-awesome.css, gsap.js, ionicons.js

Button Squish Animation

Author:
Aaron Iker | May 21, 2020
Made with:
HTML / CSS (SCSS) / JS

Compatible browsers:
Chrome, Edge, Firefox, Opera, Safari
Responsive:
yes
Dependencies:
gsap.js

Discover Our Extensive Snippet Library

This heading suggests that your website provides a wide variety of snippets across different technologies, encouraging users to explore and use these resources for their development projects.

HTML Snippets.

Explore a collection of HTML snippets designed to streamline your web development process. From basic structures to complex elements.

CSS Snippets.

Discover powerful CSS snippets that help you style your web pages with ease. Whether you need layout solutions, animations

JavaScript Snippets.

Enhance your website's interactivity with our JavaScript snippets. From DOM manipulation to advanced algorithms

Bootstrap Snippets.

Leverage the power of Bootstrap with our collection of snippets. Quickly integrate responsive design components

Tailwind Snippets.

Speed up your development process with Tailwind CSS snippets. These utility-first CSS snippets enable you to

jQuery Snippets.

Simplify your JavaScript development with jQuery snippets. Easily perform common tasks like event handling, animations

React Snippets.

Build robust, component-based user interfaces with our React snippets. From state management to lifecycle methods,

Vue Snippets.

Streamline Vue.js development with our collection of snippets for creating components, managing state, and handling events.

Ready to set your Brand ablaze?

Let's craft a visual identity that ignites passion and loyalty. ✨