Skip to content

Conversation

@elizabetdev
Copy link
Member

@elizabetdev elizabetdev commented Dec 29, 2025

Summary

Adds loading states to the Button component with a CSS-based shimmer animation effect.

Changes

Button Component

  • Added loading prop with shimmer animation using ::before pseudo-element
  • Two animation variants: shimmerFullWidth (percentage-based) and shimmerFixedWidth (200px)
  • Loading buttons are disabled with aria-disabled="true" for a11y
  • Text/icons dimmed to 70% opacity, cursor: not-allowed

Theme Tokens

  • Added loading gradient to button background tokens for all types (primary, secondary, danger, empty)
  • Updated light/dark theme tokens and synced Figma Studio Tokens

Tests

  • Added loading state tests for a11y, click prevention, label visibility, and all button types

How to test

https://click-ui-git-add-button-loading-states-clickhouse.vercel.app/?path=/docs/buttons-button--docs

@vercel
Copy link

vercel bot commented Dec 29, 2025

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Review Updated (UTC)
click-ui Ready Ready Preview, Comment Jan 2, 2026 3:19pm

…er effect direction in styles. Ensure proper formatting in dark theme variables file.
Enhance Button component tests by adding multiple scenarios for the loading state, including aria-disabled attribute, preventing onClick execution, and ensuring the label is rendered correctly. Cover loading states for various button types: primary, secondary, danger, and empty.
…e tokens for improved consistency and readability
@@ -1,5 +1,5 @@
import { Icon, IconName } from "@/components";
import { styled } from "styled-components";
import { styled, keyframes, css } from "styled-components";
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@vineethasok can you chime in here? Aren't you in the process of removing styled-components? Is this something we should implement with a different piece of technology?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@hoorayimhelping @vineethasok I’m happy to leave this PR as a draft as a POC, or I can just create a PR with the new gradient tokens. Let me know what works best.

Eliminated the unused 'css' import from styled-components in Button.tsx and replaced template literal usages to remove dependency on the css helper.
Replaces template literal keyframes with object syntax for shimmer animations and moves shimmer logic from styled-components CSS to data attributes and prop-based logic. This simplifies the loading state handling and improves maintainability.
@elizabetdev elizabetdev merged commit 9e529b9 into main Jan 2, 2026
6 checks passed
@elizabetdev elizabetdev deleted the add-button-loading-states branch January 2, 2026 15:29
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants