<ButtonIcon> Component
<ButtonIcon> is a <Button> component with built in <Icon> component.
Here the demo:
<ButtonIcon> Component<ButtonIcon> is a <Button> component with built in <Icon> component.
Here the demo:
<ButtonIcon> ComponentThere are 2 ways to install <ButtonIcon> component into your react app project:
<ButtonIcon> Component<ButtonIcon> ComponentBecause <ButtonIcon> uses <Icon> and the <Icon> itself needs to be configured first, you'll need to do: Configuring <Icon>'s Resources below:
<Icon>'s ResourcesAfter 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/*.svgDone! The required resources by the <Icon> and <ButtonIcon> component are now set! 😉
icon PropertySelect 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.
There a pretty much of common icon sets that ready to use for general projects.
To add custom icons, for example a logo icon, follow these steps:
iconPosition PropertyDetermines the position of the icon.
The possible values are:
undefined'start''end'Here the preview:
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:
href PropertyNavigates to another pages or to external websites using traditional link.
onClick PropertyExecutes a JavaScript's callback function when the <ButtonIcon> is clicked.
The alternative appearances of the <ButtonIcon> layout without changing the <ButtonIcon>'s functionality.
buttonStyle PropertySets the alternative appearances of the <ButtonIcon>.
The possible values are:
undefined'regular''link''ghost'Here the preview:
orientation PropertySets the orientation of the <ButtonIcon>.
The possible values are:
undefined'inline''block'Here the preview:
size PropertyDefines the alternative size of the <ButtonIcon>.
The possible values are:
undefined'xs''sm''md''lg''xl'Here the preview:
theme PropertyDefines the contextual theme of the <ButtonIcon>.
The possible values are:
undefined'primary''secondary''success''info''warning''danger''light''dark'Here the preview:
gradient PropertyActivates a 3D mode of the <ButtonIcon>.
The possible values are:
undefined'inherit'truefalseHere the preview:
outlined PropertyActivates an outlined mode (background-less, contrast foreground, and contrast border) of the <ButtonIcon>.
The possible values are:
undefined'inherit'truefalseHere the preview:
mild PropertyActivates a mild mode (mild background, contrast foreground, and contrast border) of the <ButtonIcon>.
The possible values are:
undefined'inherit'truefalseHere the preview:
nude PropertyActivates an nude mode (background-less, padding-less, and border-less) of the <ButtonIcon>.
The possible values are:
undefinedtruefalseHere the preview:
The conditions of the <ButtonIcon> behavior or functionality.
enabled PropertyDefines the enabled/disabled state of the <ButtonIcon>.
The possible values are:
undefinedtruefalseHere the preview:
inheritEnabled PropertyInfluences the <ButtonIcon>'s disabled state by <ancestor enabled={false}>.
The possible values are:
undefinedtruefalseHere the preview:
active PropertyDefines the current active state of the <ButtonIcon>.
The possible values are:
undefinedtruefalseHere the preview:
inheritActive PropertyInfluences the <ButtonIcon>'s active state by <ancestor active={true}>.
The possible values are:
undefinedtruefalseHere the preview:
Overwrites the internal (sub) components used as the composition of <ButtonIcon> component.
buttonComponent PropertyOverwrites the internal <Button> component used as the composition of <ButtonIcon> component.
<ButtonIcon buttonComponent={
<MyCustomButton />
} />iconComponent PropertyOverwrites the internal <Icon> component used as the composition of <ButtonIcon> component.
<ButtonIcon iconComponent={
<MyCustomIcon />
} />Because <ButtonIcon> is made from <Button>, so all properties from <Button> are inherited.
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:
The example of accessing, modifying, & adding variables: