Overview
The Button component is the primary interactive element in the A’raf Design System. It can render as a<button> or <a> tag automatically depending on whether the href prop is provided.
Installation
Usage
Variants
Button has 7 visual hierarchies reflecting the level of action emphasis.Primary
Used for the primary and most important action on a page. Use sparingly — one per view at most.When to use
- Primary form submission
- Page-level CTA
- Irreversible actions
When not to use
- More than one important action in the same area
- Secondary or tertiary actions
Secondary
Two variants:secondary with a light blue background and secondary-gray with a gray border. Use alongside Primary for alternative actions.
Tertiary
A borderless button that looks like plain text but retains an interactive hit area. Use for tertiary actions that don’t need visual prominence.Link
Appears as a hyperlink. Available in two colors:link-color and link-gray.
Add the
href prop to make this button render as an anchor tag for navigation.Destructive
Red variant for dangerous or permanent actions. Available across all hierarchies.Sizes
5 sizes are available to match different layout contexts.States
Avoid hiding a button when it is unavailable. Use
isDisabled so users can still see the action exists.Icons
Button supports icons on the left, right, or in icon-only mode.As Link
Button renders as an<a> tag simply by adding the href prop.
API Reference
string
default:"primary"
Visual hierarchy of the button. Values:
primary · secondary · secondary-gray · tertiary · tertiary-gray · link-color · link-gray · primary-destructive · secondary-destructive · tertiary-destructive · link-destructivestring
default:"md"
Button size. Values:
sm · md · lg · xl · 2xlboolean
default:"false"
Disables interaction and applies the disabled visual state.
boolean
default:"false"
Shows a loading spinner and prevents interaction.
boolean
default:"false"
When
true, the children text remains visible during isLoading.ComponentType
Icon component rendered to the left of the label. Without
children, the button becomes icon-only.ComponentType
Icon component rendered to the right of the label.
string
When provided, the button renders as an
<a> anchor tag.string
Additional Tailwind classes for custom overrides.
Accessibility
- Uses a semantic
<button>element by default - The
disabledstate is handled with the nativedisabledattribute - Keyboard focus is shown with a
4px #CDE4F5outline ring - Icon-only mode requires an
aria-label - When rendered as a link (
href), full anchor semantics apply
Do’s & Don’ts
Do
- Use Primary for one main action per page
- Pair Primary + Secondary for confirm/cancel actions
- Always add
aria-labelon icon-only buttons - Use the Destructive variant for irreversible actions
Don't
- Don’t use more than one Primary button in the same section
- Don’t use custom colors outside the design system
- Don’t hide a disabled button — use the
isDisabledprop instead - Don’t use the Link variant for actions that modify data