Overview
The Button component is a fundamental interactive element that triggers actions when clicked. It supports multiple visual variants, sizes, icons, loading states, and accessibility features.Import
Basic Usage
Properties
Inputs
Text label displayed on the button
Lucide icon name to display (e.g., ‘home’, ‘user’, ‘settings’)
Visual style variant of the buttonOptions:
'primary' | 'secondary' | 'success' | 'info' | 'warning' | 'danger' | 'help' | 'premium'Display variant of the buttonOptions:
'solid' | 'text' | 'outlined'Size of the buttonOptions:
'small' | 'normal' | 'large'Position of the icon relative to the labelOptions:
'left' | 'right'When true, button is disabled and cannot be clicked
When true, button shows loading state and is disabled
When true, button has fully rounded corners (22px border-radius)
Shadow elevation level (0-7)Options:
0 | 1 | 2 | 3 | 4 | 5 | 6 | 7Custom size for the icon in pixels
Custom background color (CSS color value)
Custom width (CSS value, e.g., ‘200px’, ‘100%’)
Custom height (CSS value)
Custom ARIA label for accessibility. Falls back to label or icon name if not provided
Outputs
Emitted when the button is clicked (while not disabled or loading)
Alternative click event (same as onClick)
Examples
Severity Variants
Display Variants
With Icons
States
Sizes
Custom Styling
Accessibility
The Button component includes comprehensive accessibility features:- ARIA Labels: Automatically generates aria-label from label text or icon name
- Disabled State: Properly communicates disabled state to assistive technologies
- Keyboard Support: Fully accessible via keyboard (Enter/Space)
- Focus Management: Visual focus indicators for keyboard navigation
ARIA Label Resolution
- Uses custom
ariaLabelif provided - Falls back to
labeltext if available - Generates descriptive label from
iconname (e.g., “settings button”) - Defaults to “Button” if nothing else is available
Component Details
- Selector:
magary-button - Source:
/home/daytona/workspace/source/projects/ng-magary/src/lib/Button/button/button.ts - Standalone: Yes
- Change Detection: OnPush
