4.0.0 • Published 2 years ago

@times-tooling/button-set v4.0.0

Weekly downloads
29
License
BSD-3-Clause
Repository
-
Last release
2 years ago

How to use

yarn add @times-tooling/button-set
import ButtonSet from '@times-tooling/button-set'
import { faRocket, faEdit, faSquare } from '@fortawesome/free-solid-svg-icons';

<ButtonSet
    onChange={() => {}}
    value={''}
    name="button-set"
    buttons={[
        { value: 'value', title: 'Click A', icon: faRocket },
        { value: 'value', title: 'Click B', icon: faEdit },
        { value: 'value', title: 'Click C', icon: faSquare },
    ]}
/>

Props

onChange

Fired when the user clicks a button in the set. It should update value in the parent state.

value

The selected button in the set that has a matching value prop

name

The name of the input element

buttons

An array of button configuration objects that have value, title, and an icon

Note: when using font-awesome, you'll need to set up a library of icons in your app, as follows:

import { library } from '@fortawesome/fontawesome-svg-core';
import { faPencilAlt } from '@fortawesome/free-solid-svg-icons';

library.add(faPencilAlt);

...

<ButtonSet buttons=[{ icon: 'pencil-alt' }] />

You can also pass in a specific icon like this:

import { library } from '@fortawesome/fontawesome-svg-core';
import { faPencilAlt } from '@fortawesome/free-solid-svg-icons';

...

<ButtonSet buttons={[{ icon: faPencilAlt }]} />

Development

yarn build
yarn test
4.0.0

2 years ago

3.0.2

4 years ago

3.0.1

4 years ago

3.0.0

5 years ago

2.3.6

5 years ago

2.3.4

5 years ago

2.3.3

6 years ago

2.3.2

6 years ago

2.3.1

6 years ago

2.3.0

6 years ago

2.2.2

6 years ago

2.2.1

6 years ago

2.2.0

6 years ago

2.1.0

6 years ago

2.0.2

6 years ago

2.0.1

6 years ago

2.0.0

6 years ago

1.1.3

6 years ago

1.1.1

6 years ago

1.1.0

7 years ago

1.0.27

7 years ago

1.0.26

7 years ago

1.0.25

7 years ago

1.0.24

7 years ago

1.0.23

7 years ago

1.0.22

7 years ago

1.0.20

7 years ago

1.0.19

7 years ago

1.0.18

7 years ago

1.0.17

7 years ago

1.0.16

7 years ago

1.0.14

7 years ago

1.0.13

7 years ago

1.0.12

7 years ago

1.0.11

7 years ago