<Button />

Button is the primary component for communicating actionable elements to users.

Usage

Use the variant prop to switch between button styles. Buttons support hover, active, and disabled states.

variant

filled

Outlined

base

hover

active

disabled

<Button variant='filled'>Filled</Button> <Button variant='outlined'>Outlined</Button>

Full width

Pass the fullWidth prop and the button will fill its container's width.

<Button fullWidth>Componentry</Button>

Icons

Pass a startIcon or endIcon to add a Button icon element.

<Button startIcon='github'>Componentry</Button>

Props

Name
Description
children

ReactNode
color

Button variant color

"primary"
disabled

Disables the element, preventing mouse and keyboard events

boolean
endIcon

Icon positioned after button content

string | Element
fullWidth

Toggles full width element layout

boolean
href

HTML element href

string
size

Sets the display size

"small" | "large"
startIcon

Icon positioned before button content

string | Element
variant

Display variant

"filled" | "outlined"
wrapWhenDisabled

Indicates whether buttons in a disabled state should be wrapped with a span

boolean

TypeScript customization

You can use module augmentation to customize the TypeScript types for any of Button's props:

declare module 'componentry/types/components/Button/Button' { interface ButtonPropsOverrides { // ... overwrite any types for Button props ... } }

See the TypeScript guide for more information.

StylingButton styles

Class
Description
.C9Y-Button-DisabledWrapper
Class applied to disabled buttons' wrapper element
.C9Y-Button-Icon
Base class applied to all Button Icons
.C9Y-Button-Icon-largeSize
Sizing class applied Button Icons when `size="large"`
.C9Y-Button-Icon-smallSize
Sizing class applied to Button Icons when `size="small"`
.C9Y-Button-base
Base class applied to all variants for shared structural styles
.C9Y-Button-filled
Variant class applied when `variant="filled"`
.C9Y-Button-largeSize
Sizing class applied when `size="large"`
.C9Y-Button-outlined
Variant class applied when `variant="outlined"`
.C9Y-Button-smallSize
Sizing class applied when `size="small"`