Button Component
Button Component
Section titled “Button Component”The Button component is a clickable element that triggers an action with different variants and sizes.
All Variants
Section titled “All Variants”Installation
Section titled “Installation”pnpm add @aetherui-kit/corenpm install @aetherui-kit/coreyarn add @aetherui-kit/coreImport
Section titled “Import”// Option 1: Import and register specific componentimport { defineAeButton } from '@aetherui-kit/core/button';defineAeButton();
// Option 2: Import and register all components at onceimport { defineAll } from '@aetherui-kit/core';defineAll();Basic Usage
Section titled “Basic Usage”Variants
Section titled “Variants”The button component supports three variants: primary, secondary, and ghost.
The button component supports three sizes: sm, md (default), and lg.
Disabled State
Section titled “Disabled State”The button supports icons through the icon slot. You can position the icon at the start or end using the icon-position attribute.
Common Usage Patterns
Section titled “Common Usage Patterns”| Name | Type | Default | Description |
|---|---|---|---|
variant |
'primary' | 'secondary' | 'ghost' |
'primary' |
Visual style variant of the button |
size |
'sm' | 'md' | 'lg' |
'md' |
Applied to padding & font-size |
disabled |
boolean |
false |
Native disable state |
icon-position |
'start' | 'end' |
'start' |
Position of the icon when both icon and text are present |
| Name | Description |
|---|---|
default |
The button’s label text |
icon |
Icon content that can be positioned at start or end |
CSS Parts
Section titled “CSS Parts”| Name | Description |
|---|---|
base |
The button element |
label |
Text wrapper element |
icon |
The icon wrapper element |
CSS Custom Properties
Section titled “CSS Custom Properties”| Name | Description |
|---|---|
--ae-button-bg-primary |
Primary button background color |
--ae-button-fg-primary |
Primary button text color |
--ae-button-bg-secondary |
Secondary button background color |
--ae-button-fg-secondary |
Secondary button text color |
--ae-color-brand-600 |
Used for ghost button color and focus ring |
--ae-button-radius |
Button border radius |
--ae-button-padding-x |
Horizontal button padding |
--ae-button-padding-y |
Vertical button padding |
--ae-button-gap |
Gap between button text and icon |
--ae-focus-ring-color |
Focus ring color |
Styling Examples
Section titled “Styling Examples”Custom styling can be applied using CSS custom properties and shadow parts:
/* Make ghost variant transparent with brand-color text */ae-button[variant="ghost"]::part(base) { background: transparent; color: var(--ae-color-brand-600);}
/* Apply custom theme colors */:root { --ae-button-bg-primary: #5e3bee; --ae-button-fg-primary: white; --ae-color-brand-600: #5e3bee;}
/* Dark theme */[data-theme="dark"] { --ae-button-bg-primary: #7353eb; --ae-color-brand-600: #7353eb;}Accessibility
Section titled “Accessibility”The button component follows WAI-ARIA guidelines:
- Uses native
<button>element semantics - Requires aria-labels for icon-only buttons
- Supports keyboard navigation
- Maintains proper focus styling with visible focus rings
- Includes proper disabled state styling and attributes
Browser Support
Section titled “Browser Support”- Chrome, Edge, Safari 15+, Firefox ESR