Skip to content

Commit 49858d0

Browse files
committed
updated properties and more
1 parent eae2b5d commit 49858d0

File tree

1 file changed

+31
-25
lines changed

1 file changed

+31
-25
lines changed

README.md

Lines changed: 31 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -4,11 +4,11 @@
44

55
Checkbox replacement using stylish bootstrap-4 switch button.
66

7-
Lightweight, pure JavaScript, no dependencies.
7+
Lightweight, no dependencies, easy webpack integration.
88

99
## Installation
1010
```sh
11-
npm i bootstrap-switch-button-react --save
11+
npm i bootstrap-switch-button-react --save-dev
1212
```
1313

1414
## Demo
@@ -18,7 +18,7 @@ import BootstrapSwitchButton from 'bootstrap-switch-button-react'
1818
<BootstrapSwitchButton
1919
checked={false}
2020
onlabel='Admin User'
21-
offlabel='Normal User'
21+
offlabel='Regular User'
2222
onChange={(checked: boolean) => {
2323
this.setState({ isUserAdmin: checked })
2424
}}
@@ -27,25 +27,31 @@ import BootstrapSwitchButton from 'bootstrap-switch-button-react'
2727

2828
![Demo](https://github.com/gitbrent/bootstrap-switch-button-react/blob/master/img/demo.gif?raw=true)
2929

30-
## Options
31-
32-
Name |Type |Default |Description |
33-
----------|-----------|----------|----------------------------|
34-
`on` |string/html|"On" |Text of the on toggle
35-
`off` |string/html|"Off" |Text of the off toggle
36-
`size` |string |"normal" |Size of the toggle. Possible values are: `large`, `normal`, `small`, `mini`.
37-
`onstyle` |string |"primary" |Style of the on toggle. Possible values are: `primary`,`secondary`,`success`,`danger`,`warning`,`info`,`light`,`dark`
38-
`offstyle`|string |"light" |Style of the off toggle. Possible values are: `primary`,`secondary`,`success`,`danger`,`warning`,`info`,`light`,`dark`
39-
`style` |string | |Appends the value to the class attribute of the toggle. This can be used to apply custom styles. Refer to Custom Styles for reference.
40-
`width` |integer |*null* |Sets the width of the toggle. if set to *null*, width will be auto-calculated.
41-
`height` |integer |*null* |Sets the height of the toggle. if set to *null*, height will be auto-calculated.
42-
43-
## Methods
44-
45-
Method |Description
46-
-----------|------------------------------------------
47-
on |Sets the toggle to 'On' state
48-
off |Sets the toggle to 'Off' state
49-
toggle |Toggles the state of the toggle on/off
50-
enable |Enables the toggle
51-
disable |Disables the toggle
30+
## Properties
31+
32+
Name |Type |Default |Description |
33+
-----------|------------|----------|----------------------------|
34+
`onlabel` |string/html |"On" |Text of the on switch-button
35+
`offlabel` |string/html |"Off" |Text of the off switch-button
36+
`size` |string | |Size of the switch-button. Possible values are: `xs`, `sm`, `lg` (no size specified means normal size).
37+
`onstyle` |string |"primary" |Style of the on switch-button. Possible values are: `primary`,`secondary`,`success`,`danger`,`warning`,`info`,`light`,`dark`
38+
`offstyle` |string |"light" |Style of the off switch-button. Possible values are: `primary`,`secondary`,`success`,`danger`,`warning`,`info`,`light`,`dark`
39+
`style` |string | |Appends the value to the class attribute of the switch-button. This can be used to apply custom styles. Refer to Custom Styles for reference.
40+
`width` |integer | |Sets the width of the switch-button. if set to *null*, width will be auto-calculated.
41+
`height` |integer | |Sets the height of the switch-button. if set to *null*, height will be auto-calculated.
42+
43+
## Example
44+
45+
```typescript
46+
<BootstrapSwitchButton
47+
checked={false}
48+
onlabel='Admin User'
49+
onstyle='danger'
50+
offlabel='Regular User'
51+
offstyle='success'
52+
style='w-100 mx-3'
53+
onChange={(checked: boolean) => {
54+
this.setState({ isUserAdmin: checked })
55+
}}
56+
/>
57+
```

0 commit comments

Comments
 (0)