Skip to main content
The Button component provides a versatile way to trigger actions or navigate within your application. It supports multiple variants, colors, and states including loading and disabled states.

Basic Usage

import { Button } from 'reshaped';

function App() {
  return (
    <Button variant="solid" color="primary">
      Click me
    </Button>
  );
}

Variants

Button supports four visual variants:
<Button variant="solid">Solid</Button>
<Button variant="outline">Outline</Button>
<Button variant="ghost">Ghost</Button>
<Button variant="faded">Faded</Button>

Colors

Button can be displayed in multiple colors:
<Button color="primary">Primary</Button>
<Button color="critical">Critical</Button>
<Button color="positive">Positive</Button>
<Button color="neutral">Neutral</Button>
<Button color="media">Media</Button>

Sizes

Button supports four size options:
<Button size="small">Small</Button>
<Button size="medium">Medium</Button>
<Button size="large">Large</Button>
<Button size="xlarge">Extra Large</Button>

With Icons

Add icons to the start or end position:
import { Button } from 'reshaped';
import IconPlus from '@/icons/Plus';
import IconArrowRight from '@/icons/ArrowRight';

<Button icon={IconPlus}>Add Item</Button>
<Button endIcon={IconArrowRight}>Continue</Button>
<Button icon={IconPlus} /> {/* Icon only */}

States

Loading State

Show a loading indicator while an action is in progress:
<Button loading loadingAriaLabel="Loading...">
  Submit
</Button>

Disabled State

Disable user interaction:
<Button disabled>Disabled</Button>

Highlighted State

Highlight the button when it represents an active state:
<Button highlighted>Active</Button>
Use Button as a link by providing an href:
<Button href="/dashboard">Go to Dashboard</Button>

Styling Options

Rounded

Create a circular button:
import IconPlus from '@/icons/Plus';

<Button rounded icon={IconPlus} />

Elevated

Apply elevation shadow:
<Button elevated>Elevated Button</Button>

Full Width

Make the button take the full width of its container:
<Button fullWidth>Full Width Button</Button>

Button Group

Group multiple buttons together:
import { Button } from 'reshaped';

function App() {
  return (
    <Button.Group>
      <Button>First</Button>
      <Button>Second</Button>
      <Button>Third</Button>
    </Button.Group>
  );
}

Button Aligner

Align a button to a specific side within a container:
import { Button } from 'reshaped';

function App() {
  return (
    <Button.Aligner side="end">
      <Button>Aligned Button</Button>
    </Button.Aligner>
  );
}

Props

Button

variant
'solid' | 'outline' | 'ghost' | 'faded'
default:"solid"
Component render variant
color
'primary' | 'critical' | 'positive' | 'neutral' | 'media' | 'inherit'
default:"neutral"
Component color scheme
size
'small' | 'medium' | 'large' | 'xlarge'
default:"medium"
Component size (responsive)
icon
React.ComponentType
SVG component for the icon at the start position
endIcon
React.ComponentType
SVG component for the icon at the end position
loading
boolean
default:"false"
Show loading state
loadingAriaLabel
string
aria-label attribute for the loading indicator
disabled
boolean
default:"false"
Disable user interaction
rounded
boolean
default:"false"
Change border radius to fully rounded corners
elevated
boolean
default:"false"
Apply elevated styles to the component
fullWidth
boolean
default:"false"
Make the component take the full width of the parent element (responsive)
highlighted
boolean
default:"false"
Highlight the component when used for an active state
href
string
URL to navigate to when clicked
onClick
(event: React.MouseEvent) => void
Callback when the button is clicked
type
'button' | 'submit' | 'reset'
HTML button type attribute
stopPropagation
boolean
Stop event propagation when clicked
as
React.ElementType
Override the root element type
render
function
Custom render function for advanced use cases
className
string
Additional CSS class name
attributes
object
Additional HTML attributes
children
React.ReactNode
Button content

Button.Group

children
React.ReactNode
required
Node for inserting child Button components
className
string
Additional CSS class name
attributes
object
Additional HTML attributes

Button.Aligner

side
'start' | 'end' | 'inline'
Side to align the button to
children
React.ReactElement
required
Button element to align
className
string
Additional CSS class name
attributes
object
Additional HTML attributes

Build docs developers (and LLMs) love