4.0.0 • Published 11 months ago

@times-tooling/button-set v4.0.0

Weekly downloads
29
License
BSD-3-Clause
Repository
-
Last release
11 months 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

11 months ago

3.0.2

3 years ago

3.0.1

3 years ago

3.0.0

3 years ago

2.3.6

3 years ago

2.3.4

3 years ago

2.3.3

5 years ago

2.3.2

5 years ago

2.3.1

5 years ago

2.3.0

5 years ago

2.2.2

5 years ago

2.2.1

5 years ago

2.2.0

5 years ago

2.1.0

5 years ago

2.0.2

5 years ago

2.0.1

5 years ago

2.0.0

5 years ago

1.1.3

5 years ago

1.1.1

5 years ago

1.1.0

6 years ago

1.0.27

6 years ago

1.0.26

6 years ago

1.0.25

6 years ago

1.0.24

6 years ago

1.0.23

6 years ago

1.0.22

6 years ago

1.0.20

6 years ago

1.0.19

6 years ago

1.0.18

6 years ago

1.0.17

6 years ago

1.0.16

6 years ago

1.0.14

6 years ago

1.0.13

6 years ago

1.0.12

6 years ago

1.0.11

6 years ago