Reusable button component
npm install @squiz/xaccel-assisted-buttonThis component will create button or anchor tag with the settings provided by the user. It can be used in any other repository.
| Property | Property description | Property type | IsRequired |
| :------------------: | :-------------------------: | :---------------: | :--------: |
| buttonType | Item type - button or a | string | [x] |
| classObject | The object of class names | classNameOverride | |
| ...jsxElementProps | button or anchor attributes | strings | |
- Displaying anchor:
To display anchor tag please set buttonType to 'a'.
- Displaying button:
To display button tag please set buttonType to 'button'
``JSX`
onClick={() => console.log('test console.log')}
classObject={{
className: "storybook-button",
cssModule: {
'storybook-button__wrapper': 'button__wrapper--customForTest',
},
replaceBaseClass: false,
retainMissingModuleClasses: true,
}}
>
Click me
For more information about classObject please visit packages/utility/functions/src/generateClasses.js
Install the package by running: npm i @squiz/xaccel-assisted-button
`JSX
import AssistedButton from '@squiz/xaccel-assisted-button';
function SomeReactComponent() {
className: custom-class,``
replaceBaseClass: false,
retainMissingModuleClasses: true,
}}
onClick={() => console.log('test console.log')}
>
Test text
}