Component
Gradient Button
Gradient buttons with linear, multi-stop, directional, pill, shadow, and dark background variants
- Component
- Tailwind
- MIT
Preview
Live component
9:41 100%
devsnips.dev/library/tailwind/components/buttons/gradient-button/ fluid · no fixed width 100%
Install
Add to your project
npx devsnips add Tailwind/Components/Buttons/gradient-button Tailwind/Components/Buttons/gradient-button <!-- Linear Gradient Button -->
<button class="px-6 py-2.5 bg-gradient-to-r from-blue-500 to-blue-600 text-white font-medium rounded-lg hover:opacity-90 focus:outline-none focus:ring-2 focus:ring-blue-500 focus:ring-offset-2 transition-opacity">
Blue Gradient
</button>
<!-- Purple Pink -->
<button class="px-6 py-2.5 bg-gradient-to-r from-purple-500 to-pink-500 text-white font-medium rounded-lg hover:opacity-90 focus:outline-none focus:ring-2 focus:ring-purple-500 focus:ring-offset-2 transition-opacity">
Purple Pink
</button>
<!-- Sizes -->
<button class="px-3 py-1.5 bg-gradient-to-r from-blue-500 to-purple-500 text-white text-xs font-medium rounded-md hover:opacity-90 focus:outline-none focus:ring-2 focus:ring-purple-500 transition-opacity">
Small
</button>
<button class="px-4 py-2 bg-gradient-to-r from-blue-500 to-purple-500 text-white text-sm font-medium rounded-lg hover:opacity-90 focus:outline-none focus:ring-2 focus:ring-purple-500 transition-opacity">
Default
</button>
<button class="px-6 py-3 bg-gradient-to-r from-blue-500 to-purple-500 text-white text-base font-medium rounded-lg hover:opacity-90 focus:outline-none focus:ring-2 focus:ring-purple-500 transition-opacity">
Large
</button> # Gradient Button
A collection of gradient button components with various styles and effects.
## Variants
| Variant | Description |
|---------|-------------|
| [Linear](./linear/) | Two-color horizontal gradient buttons |
| [Shadow](./shadow/) | Gradient buttons with colored shadows |
## Quick Start
```html
<!-- Basic Linear Gradient -->
<button class="px-6 py-2.5 bg-gradient-to-r from-blue-500 to-blue-600 text-white font-medium rounded-lg hover:opacity-90 focus:outline-none focus:ring-2 focus:ring-blue-500 focus:ring-offset-2">
Click Me
</button>
```
## Gradient Directions
| Class | Direction |
|-------|-----------|
| `bg-gradient-to-r` | Left → Right |
| `bg-gradient-to-l` | Right → Left |
| `bg-gradient-to-t` | Bottom → Top |
| `bg-gradient-to-b` | Top → Bottom |
| `bg-gradient-to-tr` | Bottom Left → Top Right |
| `bg-gradient-to-tl` | Bottom Right → Top Left |
| `bg-gradient-to-br` | Top Left → Bottom Right |
| `bg-gradient-to-bl` | Top Right → Bottom Left |
## Accessibility
- All buttons include visible focus rings
- Use `disabled` attribute for disabled state
- Minimum touch target: 44×44px
- Ensure sufficient color contrast
## Customization
### Custom Colors
```html
<button class="bg-gradient-to-r from-[#your-color] to-[#your-color]">
```
### Custom Shadow Colors
```html
<button class="shadow-lg shadow-[color]/[opacity]">
```
## Related
- [Glass Button](../glass-button/) - Frosted glass effect
- [Animated Button](../animated-button/) - Hover animations
- [Icon Button](../icon-button/) - Icon + text combinations 22 lines UTF-8 · LF · Spaces: 2
Continue browsing