Button
Button Component
The Button component provides a foundational button element with support for various styles, states, and behaviors.
Example
Usage
import Button from "@altitude/ui/react/ui/button";
export default function ButtonExample() { const handleClick = () => { console.log("Button clicked"); };
return ( <div> <Button className="skin-primary" onClick={handleClick}> Click Me </Button>
<Button className="skin-secondary" type="submit"> Submit Form </Button>
<Button className="skin-primary-emphasised" disabled={isLoading}> {isLoading ? "Loading..." : "Save Changes"} </Button> </div> );}Props
| Prop | Type | Required | Description |
|---|---|---|---|
| children | ReactNode | Yes | Content to be displayed inside the button |
| className | string | No | CSS class names to apply custom styling |
| type | string | No | HTML button type (“button”, “submit”, “reset”). Default: “button” |
| disabled | boolean | No | Whether the button is disabled. Default: false |
| onClick | function | No | Event handler for button click |
All other standard HTML button attributes are also supported and passed through to the underlying button element.
Skin Classes
The Button component accepts various skin classes to change its appearance:
skin-primary: Standard primary button styleskin-secondary: Less prominent button styleskin-primary-emphasised: Emphasized primary button for important actionsinteractive: Applied by default for proper hover/active states
Accessibility
The Button component follows accessibility best practices:
- Uses native HTML button element
- Preserves proper focus states
- Handles disabled states correctly
- Supports keyboard navigation