Installing <ButtonIcon> Component

There are 2 ways to install <ButtonIcon> component into your react app project:

  • Install the Specific Package of <ButtonIcon> Component
  • Install the Whole Reusable-UI Component Pack, including the <ButtonIcon> Component

Because <ButtonIcon> uses <Icon> and the <Icon> itself needs to be configured first, you'll need to do: Configuring <Icon>'s Resources below:

Configuring <Icon>'s Resources

After you install the <ButtonIcon>, you need to manually copy some resources into your application public directory.

Go to /node_modules/@reusable-ui/icon/public directory. Inside it, copy the fonts and icons directories into application public directory (in React: /public). So, the final files are something like this:

  • /public/fonts/*.(ttf|woff|woff2)
  • /public/icons/*.svg

Done! The required resources by the <Icon> and <ButtonIcon> component are now set! 😉

icon Property

Select an icon set (a string value) corresponding to the icon image.

There are 2 types of icon sets: Built-in icon set and Custom icon set.

Built-in Icon Sets

There a pretty much of common icon sets that ready to use for general projects.

Show icon gallery

Adding Custom Icon Sets

To add custom icons, for example a logo icon, follow these steps:

  • Prepare the Image
  • Store the Image
  • Registering the Custom Icons
  • Using the Registered Custom Icons

iconPosition Property

Determines the position of the icon.

The possible values are:

  • undefined
  • 'start'
  • 'end'

Here the preview:

Preview

Show code

Client Side Link

Navigates between pages using JavaScript way, without causing a whole page HTTP request.

<ButtonIcon> designed to work with <Link> component of React Router and Next JS (Gatsby JS and React Remix are coming soon).

When there is a <Link> component inside the <ButtonIcon>, at render phase, the hierarchy of <ButtonIcon> and <Link> is automatically swapped for you. Here the illustration:

Show code

href Property

Navigates to another pages or to external websites using traditional link.

onClick Property

Executes a JavaScript's callback function when the <ButtonIcon> is clicked.

Variant Properties

The alternative appearances of the <ButtonIcon> layout without changing the <ButtonIcon>'s functionality.

buttonStyle Property

Sets the alternative appearances of the <ButtonIcon>.

The possible values are:

  • undefined
  • 'regular'
  • 'link'
  • 'ghost'

Here the preview:

Preview

Show code

orientation Property

Sets the orientation of the <ButtonIcon>.

The possible values are:

  • undefined
  • 'inline'
  • 'block'

Here the preview:

Preview

Show code

size Property

Defines the alternative size of the <ButtonIcon>.

The possible values are:

  • undefined
  • 'xs'
  • 'sm'
  • 'md'
  • 'lg'
  • 'xl'

Here the preview:

Preview

Show code

theme Property

Defines the contextual theme of the <ButtonIcon>.

The possible values are:

  • undefined
  • 'primary'
  • 'secondary'
  • 'success'
  • 'info'
  • 'warning'
  • 'danger'
  • 'light'
  • 'dark'

Here the preview:

Preview

Show code

gradient Property

Activates a 3D mode of the <ButtonIcon>.

The possible values are:

  • undefined
  • 'inherit'
  • true
  • false

Here the preview:

Preview

Show code

outlined Property

Activates an outlined mode (background-less, contrast foreground, and contrast border) of the <ButtonIcon>.

The possible values are:

  • undefined
  • 'inherit'
  • true
  • false

Here the preview:

Preview

Show code

mild Property

Activates a mild mode (mild background, contrast foreground, and contrast border) of the <ButtonIcon>.

The possible values are:

  • undefined
  • 'inherit'
  • true
  • false

Here the preview:

Preview

Show code

nude Property

Activates an nude mode (background-less, padding-less, and border-less) of the <ButtonIcon>.

The possible values are:

  • undefined
  • true
  • false

Here the preview:

Preview

Show code

State Properties

The conditions of the <ButtonIcon> behavior or functionality.

enabled Property

Defines the enabled/disabled state of the <ButtonIcon>.

The possible values are:

  • undefined
  • true
  • false

Here the preview:

Preview

Show code

inheritEnabled Property

Influences the <ButtonIcon>'s disabled state by <ancestor enabled={false}>.

The possible values are:

  • undefined
  • true
  • false

Here the preview:

Preview

Show code

active Property

Defines the current active state of the <ButtonIcon>.

The possible values are:

  • undefined
  • true
  • false

Here the preview:

Preview

Show code

inheritActive Property

Influences the <ButtonIcon>'s active state by <ancestor active={true}>.

The possible values are:

  • undefined
  • true
  • false

Here the preview:

Preview

Show code

Component Properties

Overwrites the internal (sub) components used as the composition of <ButtonIcon> component.

buttonComponent Property

Overwrites the internal <Button> component used as the composition of <ButtonIcon> component.

<ButtonIcon buttonComponent={
    <MyCustomButton />
} />

iconComponent Property

Overwrites the internal <Icon> component used as the composition of <ButtonIcon> component.

<ButtonIcon iconComponent={
    <MyCustomIcon />
} />

Variables

There are several variables of <ButtonIcon> you can customize. Changing the variables affects all <ButtonIcon> instance and other components that depend on <ButtonIcon>.

Here the exposed variables:

  • Backgrounds, Foregrounds, Borders, & Rings
  • Spacings
  • Typos

The example of accessing, modifying, & adding variables:

Show code