# Progress Button

> A button that fills from left to right to show upload progress, set with one custom property.

- Category: [CSS Buttons](https://copy-css.com/category/buttons)
- Tags: upload, fill, percentage, loading, custom property
- Live preview: https://copy-css.com/snippets/progress-button
- License: Free for personal and commercial use. No signup, no attribution required.

## HTML

```html
<button class="btn-progress" style="--progress: 65%" aria-busy="true">Uploading… 65%</button>
```

## CSS

```css
.btn-progress {
  --progress: 0%;
  position: relative;
  isolation: isolate;
  overflow: hidden;
  min-width: 220px;
  padding: 14px 28px;
  border: 0;
  border-radius: 10px;
  background: #1e3a8a;
  color: #fff;
  font: 600 16px/1 system-ui, sans-serif;
  font-variant-numeric: tabular-nums;
  cursor: pointer;
}

.btn-progress::before {
  content: "";
  position: absolute;
  inset: 0;
  z-index: -1;
  width: var(--progress);
  background: #2563eb;
  transition: width 0.3s ease;
}

.btn-progress[aria-busy="true"] {
  cursor: progress;
}

.btn-progress:focus-visible {
  outline: 3px solid #2563eb;
  outline-offset: 3px;
}
```

## Notes

- This CSS Progress Button is 34 lines of pure CSS (0.6 KB) with no JavaScript and no dependencies. It uses transitions, keyboard focus styles and custom properties.
- Customize with: `--progress`.
- In JSX use `className` instead of `class`. In Tailwind projects put the CSS in the global stylesheet.
