Overview
Thelum-btn utility creates fully-styled, accessible buttons with smooth animations, hover effects, and adaptive padding.
CSS Implementation
Usage
Applied Classes
Thelum-btn utility applies the following Tailwind classes:
Layout
flex items-center- Flexbox with centered itemswhitespace-nowrap- Prevents text wrapping
Animation
motion-safe:transition- Smooth transitions (respects reduced-motion)duration-300- 300ms transition by defaulthover:duration-75- Faster 75ms transition on hoveractive:duration-75- Faster 75ms transition on activeease-out- Easing functionmotion-safe:active:scale-95- Slight scale down on click
Effects
hover:drop-shadow-lg- Large drop shadow on hoveractive:drop-shadow-lg- Large drop shadow on activedisabled:opacity-50- 50% opacity when disabled
Interaction
touch-manipulation- Optimized for touch devicesselect-none- Prevents text selection
Styling
lum-btn-p-2- Smart padding utility (see below)text-base- Base font sizelum-bg-lum-input-bg- Background colorhover:lum-bg-lum-input-hover-bg- Hover backgroundactive:lum-bg-lum-input-hover-bg- Active backgroundborder-radius: var(--lum-border-radius)- Rounded cornerscorner-shape: superellipse- Smooth superellipse corners
lum-btn-p-* (Padding Utility)
Smart padding utility that creates adaptive padding with a 2:1 horizontal to vertical ratio.CSS Implementation
Usage
Padding Scale
Small: 0.25rem vertical, 0.5rem horizontal (4px/8px)
Default: 0.5rem vertical, 1rem horizontal (8px/16px)
Large: 0.75rem vertical, 1.5rem horizontal (12px/24px)
Extra Large: 1rem vertical, 2rem horizontal (16px/32px)
The gap between button content (text and icons) is automatically calculated based on padding size with adaptive scaling.
CSS Variables
Horizontal padding multiplier (creates 2:1 horizontal to vertical ratio)
Border radius for button corners
Superellipse corner smoothing (0 = circle, 1 = squircle, 2+ = rounded square)
Default button background color
Hover and active background color
States
Hover State
Active State
Disabled State
Focus State
Customization Examples
Accessibility
The
lum-btn utility includes several accessibility features:- Respects
prefers-reduced-motionwithmotion-safe:variants - Touch-optimized with
touch-manipulation - Prevents accidental text selection with
select-none - Includes disabled state with visual feedback
- Inherits focus styles from
lum-bgutility
Best Practices
- Always use semantic
<button>elements for actions - Add
type="button"to prevent form submission - Include descriptive text or
aria-labelfor icon-only buttons - Don’t override focus styles without providing alternatives
- Use appropriate color contrast for text
- Consider loading states with
disabledattribute