Button
A versatile button component with hand-drawn sketch aesthetic supporting various states, sizes, and customization options.
Button
The Button component in Faiz UI provides a hand-drawn sketch aesthetic while maintaining full functionality. It supports various states, sizes, styles, and customization options, making it suitable for a wide range of use cases while adding a unique visual flair to your interface.
Usage
Colors
Buttons come in various color options to convey different meanings and actions.
Sizes
Buttons are available in different sizes to fit various UI contexts.
Radius
Control the border radius of buttons to match your design requirements.
Variants
The Button component offers multiple style variants to suit different UI contexts.
Disabled State
Buttons can be disabled to indicate that interaction is not currently possible.
Icons
Buttons can include icons at the start or end position to enhance visual communication.
Icon Only
Create compact icon-only buttons for space-efficient interfaces.
Loading State
Buttons can display a loading state to indicate ongoing processes.
Sketchy Variant
The signature sketchy style variant enhances the hand-drawn aesthetic.
Custom Styles
Apply custom styles using Tailwind CSS classes to create unique button appearances.
Fun Combinations
Combine various properties to create unique and expressive button styles.
Dark Mode Support
Buttons automatically adapt to dark mode environments with appropriate styling adjustments.
Implementation Notes
- The Button component includes a built-in ripple effect that animates on click.
- The hand-drawn aesthetic is consistently applied across all variants and states.
- Custom loading indicators are designed to match the overall sketchy style.
- All buttons are fully accessible with keyboard navigation and screen reader support.
Props
Prop | Type | Default | Description |
---|---|---|---|
variant | 'solid' | 'outline' | 'ghost' | 'light' | 'flat' | 'sketchy' | 'solid' | The visual style variant of the button |
color | 'primary' | 'secondary' | 'success' | 'warning' | 'danger' | 'info' | 'primary' | The color theme of the button |
size | 'xs' | 'sm' | 'md' | 'lg' | 'xl' | 'md' | The size of the button |
radius | 'none' | 'sm' | 'md' | 'lg' | 'xl' | 'full' | 'md' | The border radius of the button |
isLoading | boolean | false | Whether the button is in loading state |
isDisabled | boolean | false | Whether the button is disabled |
isIconOnly | boolean | false | Whether to display the button in icon-only mode |
startIcon | React.ReactNode | undefined | The icon to display before the button text |
endIcon | React.ReactNode | undefined | The icon to display after the button text |
spinner | React.ReactNode | undefined | Custom element to display during loading state |
loadingText | string | 'Loading' | Text for the loading state (for accessibility) |
customStyles | string | undefined | Custom Tailwind CSS classes for additional styling |