Skip to main content

Button

Button is a UI component in React that provides an <button> functional with extra power.

Import

import {Button} from 'frontik/react/Button'

Usage

Basic Button

<Button>Text</Button>
<Button variant="contained">Contained</Button>
<Button variant="outlined">Outlined</Button>

Disabled Button

<Button disabled >Text</Button>
<Button disabled variant="contained">Contained</Button>
<Button disabled variant="outlined">Outlined</Button>

Loading Button

Loading State

<Button loading >Text</Button>
<Button loading variant="contained">Contained</Button>
<Button loading variant="outlined">Outlined</Button>

Loading Indicator

<Button loading loadingIndicator="Loading...">Click me!</Button>
<Button loading loadingIndicator={<div></div>}>Click me!</Button>

Loading Position

<Button loading loadingPosition='start' startIcon='start' variant='contained'>Click me!</Button>
<Button loading loadingPosition='end' endIcon='end' variant='contained'>Click me!</Button>
<Button loading loadingPosition='center' variant='contained'>Click me!</Button>

Button colors

    <Button color='primary'>Primary</Button>
<Button color='secondary'>Secondary</Button>
<Button color='success'>Success</Button>
<Button color='error'>Error</Button>
<Button color='info'>Info</Button>
<Button color='warning'>Warning</Button>

Button sizes

<Button variant='outlined' size='small'>Primary</Button>
<Button variant='outlined' size='medium'>Secondary</Button>
<Button variant='outlined' size='large'>Success</Button>

API

NameTypeValuesDefaultDescription
disabledBooleantrue/falsefalseMakes button state disabled/enabled
loadingBooleantrue/falsefalseChange button loading state
sizeString"small", "medium", "large""medium"The more common sizes of the button.
colorString"primary", "secondary", "success", "error", "info", "warning""primary"The color of the button. It supports both default and custom theme colors
classNameStringOverride or extend the styles applied to the button.
childrennodeThe content of the button.
loadingIndicatornode<CircularProgress>Element placed before the children if the button is in loading state. The node should contain an element with role="progressbar" with an accessible name.
loadingPositionString"start", "end", "center""center"The loading indicator can be positioned in the button.
endIconnodeElement placed after children
startIconnodeElement placed before children
variantString"outlined", "text", "contained""text"Three common variants for button, any of which you can customize with overriding classnames

Customization With CSS / SCSS