loading-animations
intermediate
animation
loading
button
css
transitions
Category · Loading Animations Difficulty Level · Intermediate Published on · January 20, 2024

Animated Loading Button

A modern button with smooth loading animation and state transitions, perfect for form submissions and async operations.

#animation #loading #button #css #transitions

Responsive Design

Yes

Dark Mode Support

No

lines

123

Browser Compatibility

Chrome · Firefox · Safari · Edge

Live Preview

Interact with the component without leaving the page.

200px

Overview

A modern button with smooth loading animation and state transitions, perfect for form submissions and async operations.

How to use

  1. Copy the HTML markup into your page.
  2. Paste the CSS into your stylesheet and ensure the selectors match your markup.
  3. Paste the JavaScript and load it after the markup.
  4. Adjust spacing, colors, and text to match your design system.

Customization tips

  • Rename class names to avoid collisions with your existing CSS.
  • Replace hard-coded colors with CSS variables for theming.
  • Verify the layout at 320px, 768px, and 1024px widths.

HTML

9

lines

CSS

84

lines

JavaScript

30

lines


                <div class="button-container">
  <button class="loading-btn" id="loadingBtn" type="button" aria-live="polite" aria-busy="false" aria-disabled="false">
    <span class="btn-text">Submit</span>
    <span class="btn-loader">
      <span class="spinner"></span>
    </span>
  </button>
  <span class="sr-only" id="btnStatus" aria-live="polite"></span>
</div>

              
9lines
355characters
HTMLLanguage

Browser Compatibility

Chrome

>= 50

Firefox

>= 45

Safari

>= 10

Edge

>= 15

Related Code Snippets

Explore template packs

Need larger building blocks? Browse responsive landing pages and component bundles.

Open HTML Template Library ->