Skip to content
This repository was archived by the owner on Sep 25, 2020. It is now read-only.

Commit f2364c1

Browse files
committed
Add details about button plugin configuration
1 parent 19df704 commit f2364c1

File tree

1 file changed

+64
-2
lines changed

1 file changed

+64
-2
lines changed

README.md

Lines changed: 64 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -31,16 +31,78 @@ In `plugins/object-fit/index.js` you'll find an example of a plugin that adds a
3131
The only option it exposes are the variants you'd like to generate (`responsive`, `hover`, `focus`, etc.), which you pass to the plugin as a simple array:
3232

3333
```js
34-
plugins: {
34+
module.exports = {
35+
// ...
36+
37+
plugins: [
3538
// ...
3639
require('./plugins/object-fit')(['responsive']),
40+
],
3741
}
3842
```
3943

4044
This is just about the simplest type of plugin you could make.
4145

4246
## Simple Buttons
4347

44-
In `plugins/simple-buttons/index.js` you'll find an example of a plugin that adds new component classes.
48+
In `plugins/simple-buttons/index.js` you'll find an example of a plugin that adds new button component classes.
4549

4650
![](https://user-images.githubusercontent.com/4323180/37477287-b367cf88-284d-11e8-823b-f793c3ba1119.png)
51+
52+
This plugin exposes quite a number of configuration options *(all optional)*, which can be passed to the plugin as an object:
53+
54+
```js
55+
module.exports = {
56+
// ...
57+
58+
plugins: [
59+
// ...
60+
require('./plugins/simple-buttons')({
61+
62+
63+
// Set some default styles for all buttons.
64+
borderRadius: '.25rem', // Default: .25rem
65+
fontWeight: '600', // Default: 600
66+
lineHeight: '1.25', // Default: 1.25
67+
fontSize: '1rem', // Default: 1rem
68+
padding: '.5rem 1rem', // Default: .5rem 1rem
69+
70+
71+
// Specify the button colors you'd like to generate.
72+
//
73+
// By default, buttons are generated for all of Tailwind's
74+
// default base colors.
75+
colors: {
76+
// Class name: `.btn-primary`
77+
primary: {
78+
background: colors['blue'],
79+
text: colors['white'],
80+
},
81+
// Class name: `.btn-secondary`
82+
secondary: {
83+
background: colors['grey'],
84+
text: colors['black'],
85+
},
86+
},
87+
88+
89+
// Specify additional button sizes you'd like to generate.
90+
//
91+
// You can override any of the default styles from above
92+
// at any given button size.
93+
sizes: {
94+
sm: {
95+
fontSize: '.875rem',
96+
padding: '.5rem .75rem',
97+
},
98+
lg: {
99+
fontSize: '1.25rem',
100+
padding: '.75rem 1.5rem',
101+
borderRadius: '.5rem',
102+
}
103+
}
104+
}),
105+
],
106+
}
107+
```
108+

0 commit comments

Comments
 (0)