Button Generator
Create beautiful CSS buttons with hover effects, gradients, and animations
Style Presets
Button Content
Colors
Normal State
Hover State
Gradient
Sizing
Border
Effects
Live Preview
Normal
Hover (simulated)
Preview on:
Generated Code
CSS Styles
.button {
/* Content */
display: inline-flex;
align-items: center;
justify-content: center;
gap: 8px;
/* Typography */
font-size: 16px;
font-weight: 600;
text-decoration: none;
/* Spacing */
padding: 12px 24px;
/* Colors */
background-color: #3b82f6;
color: #ffffff;
/* Border */
border: 2px solid #3b82f6;
border-radius: 8px;
/* Effects */
box-shadow: none;
transition: all 0.3s ease;
/* Interaction */
cursor: pointer;
}
.button:hover {
background-color: #2563eb;
color: #ffffff;
border-color: #2563eb;
box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
transform: translateY(-2px);
}
.button:active {
transform: scale(0.98);
}
.button:focus {
outline: 2px solid #3b82f6;
outline-offset: 2px;
}HTML
<button class="button">Click Me</button>Tailwind CSS
<!-- Add Tailwind CSS and custom colors -->
<button class="inline-flex items-center justify-center gap-2 px-6 py-3 text-base font-semibold rounded-lg transition-all duration-300 ease-in-out cursor-pointer hover:-translate-y-0.5 hover:shadow-md"
style="background-color: #3b82f6; color: #ffffff; border: 2px solid #3b82f6;">
Click Me
</button>
<!-- Or use Tailwind color classes -->
<button class="inline-flex items-center justify-center gap-2 px-6 py-3 text-base font-semibold rounded-lg transition-all duration-300 ease-in-out cursor-pointer hover:-translate-y-0.5 hover:shadow-md bg-blue-500 hover:bg-blue-600 text-white border-blue-500">
Click Me
</button>React Component
import React from 'react';
const Button = ({
children = 'Click Me',
onClick,
disabled = false,
type = 'button',
...props
}) => {
const styles = {
display: 'inline-flex',
alignItems: 'center',
justifyContent: 'center',
gap: '8px',
padding: '12px 24px',
fontSize: '16px',
fontWeight: '600',
backgroundColor: '#3b82f6',
color: '#ffffff',
border: '2px solid #3b82f6',
borderRadius: '8px',
boxShadow: 'none',
cursor: disabled ? 'not-allowed' : 'pointer',
opacity: disabled ? 0.6 : 1,
transition: 'all 0.3s ease',
};
return (
<button
style={styles}
onClick={onClick}
disabled={disabled}
type={type}
{...props}
>
{children}
</button>
);
};
export default Button;Button Design Tips
Accessibility
Ensure sufficient color contrast (4.5:1 ratio) between text and background. Use focus states for keyboard navigation.
Hierarchy
Use primary buttons for main actions, secondary/outline for alternatives. Limit primary buttons per view.
Size Matters
Minimum touch target of 44x44px for mobile. Consistent sizing across your UI creates visual harmony.
Hover States
Subtle hover effects provide feedback. Avoid dramatic changes that feel jarring to users.
Need Custom UI Components?
Our team can create a complete design system with buttons, forms, and interactive elements tailored to your brand.
Get Custom Design