|
3 | 3 |
|
4 | 4 | [][npm-url]
|
5 | 5 | [][npm-url]
|
| 6 | +[][demo-url] |
6 | 7 |
|
7 | 8 | [npm-url]: https://www.npmjs.com/package/ng-toggle-button
|
| 9 | +[demo-url]: https://ng-toggle-button.netlify.app |
8 | 10 |
|
9 |
| -This is a toggle switch button component, you can see the demo [here](https://ng-toggle-button.netlify.app) and test it in [StackBlitz](https://stackblitz.com/edit/ng-toggle-button). |
| 11 | +This is a toggle switch button component, you can see the demo [here][demo-url] and test it in [StackBlitz](https://stackblitz.com/edit/ng-toggle-button). |
10 | 12 |
|
11 | 13 | ## Versions
|
12 | 14 |
|
|
82 | 84 | | value | `boolean` | `false` | Initial state of the toggle button |
|
83 | 85 | | speed | `number` | `300` | Transition time for the animation |
|
84 | 86 | | disabled | `boolean` | `false` | Button does not react on mouse events |
|
85 |
| -| color | `string` | `#0099CC` | If `String` - color of the button when checked <br>If `Object` - colors for the button when checked/unchecked or disabled<br>Example: `{checked: '#00FF00', unchecked: '#FF0000', disabled: '#CCCCCC'}` | |
86 |
| -| labels | `boolean Object` | `false` | If `boolean` - shows/hides default labels <br>If `Object` - sets custom labels for both states. <br>Example: `{checked: 'Foo', unchecked: 'Bar'}` | |
87 |
| -| switchColor | `string Object` | `#fff` | If `string` - color or background property of the switch when checked <br>If `Object` - colors or background property for the switch when checked/uncheked <br>Example: `{checked: '#25EF02', unchecked: 'silver'}` | |
| 87 | +| color | `string` | `#0099CC` | If `String` - color of the button when checked <br>If `toggleConfig` - colors for the button when checked/unchecked or disabled<br>Example: `{checked: '#00FF00', unchecked: '#FF0000', disabled: '#CCCCCC'}` | |
| 88 | +| labels | `boolean | Object` | `false` | If `boolean` - shows/hides default labels <br>If `Object` - sets custom labels for both states. <br>Example: `{checked: 'Foo', unchecked: 'Bar'}` | |
| 89 | +| switchColor | `string | toggleConfig` | `#fff` | If `string` - color or background property of the switch when checked <br>If `toggleConfig` - colors or background property for the switch when checked/uncheked or disabled <br>Example: `{checked: '#25EF02', unchecked: 'silver', disabled: '#fff'}` | |
88 | 90 | | width | `number` | `50` | Width of the button |
|
89 | 91 | | height | `number` | `22` | Height of the button |
|
90 | 92 | | margin | `number` | `3` | Space between the switch and background border |
|
91 | 93 | | name | `string` | `undefined` | Name to attach to the generated input field |
|
92 | 94 | | fontSize | `number` | `10` | Font size in pixels |
|
93 |
| -| fontColor | `string Object` | `undefined` | If `string` - color when checked <br>If `Object` - colors for labels when checked/uncheked <br>Example: `{checked: '#25EF02', unchecked: '#35DB15'}` by default the text color is white.| |
| 95 | +| fontColor | `string | toggleConfig` | `undefined` | If `string` - color when checked <br>If `toggleConfig` - colors for labels when checked/uncheked <br>Example: `{checked: '#25EF02', unchecked: '#35DB15'}` by default the text color is white.| |
94 | 96 | | values | `{checked: any, unchecked: any}` | `{checked: true, unchecked: false}` | Values for checked and unchecked states, by default checked value is `true` and unchecked value is `false` <br>Example: `{checked: 1, unchecked: 0}`.|
|
95 | 97 |
|
| 98 | +`toggleConfig` type is described below: |
| 99 | + |
| 100 | +```ts |
| 101 | +toggleConfig = { |
| 102 | + checked: string; |
| 103 | + unchecked: string; |
| 104 | + disabled?: string; |
| 105 | +}; |
| 106 | +``` |
| 107 | + |
96 | 108 | ### Outputs events
|
97 | 109 |
|
98 | 110 | | Name | Payload | Description |
|
|
0 commit comments