|
| 1 | +# md-slider |
| 2 | + |
| 3 | +`MdSlider` is a component that allows users to select from a range of values by moving the slider |
| 4 | +thumb. |
| 5 | +You can read more about the slider in the |
| 6 | +[Material Design spec](https://material.google.com/components/sliders.html). |
| 7 | + |
| 8 | +## Not Yet Implemented |
| 9 | + |
| 10 | +* Thumb Label |
| 11 | +* Color |
| 12 | +* Invert |
| 13 | +* NgModel |
| 14 | +* Keyboard Movement |
| 15 | +* Focus Ring |
| 16 | +* Smaller/grey thumb at minimum value |
| 17 | + |
| 18 | +## Usage |
| 19 | + |
| 20 | +### Setup |
| 21 | + |
| 22 | +Importing the module: |
| 23 | +```ts |
| 24 | + @NgModule({ |
| 25 | + imports: [MdSliderModule], |
| 26 | + ... |
| 27 | + }) |
| 28 | + export class MyAppModule { } |
| 29 | +``` |
| 30 | + |
| 31 | +### Basic Usage |
| 32 | + |
| 33 | +`md-slider` can be used on its own as a slider with a min of `0`, a max of `100`, and a step of `1`. |
| 34 | + |
| 35 | +```html |
| 36 | +<md-slider></md-slider> |
| 37 | +``` |
| 38 | + |
| 39 | +### Slider with Minimum and Maximum Values |
| 40 | + |
| 41 | +The min and max on a `md-slider` can be set to give a different range of values. |
| 42 | +These can be set individually and do not need to both be set. |
| 43 | + |
| 44 | +```html |
| 45 | +<md-slider min="1" max="5"></md-slider> |
| 46 | +``` |
| 47 | + |
| 48 | +### Disabled Slider |
| 49 | + |
| 50 | +`md-slider` can be disabled so that the value cannot be changed and the thumb cannot be moved. |
| 51 | + |
| 52 | +```html |
| 53 | +<md-slider disabled></md-slider> |
| 54 | +``` |
| 55 | + |
| 56 | +### Slider with Value |
| 57 | + |
| 58 | +`md-slider` can have a value defined so that it starts at a specific value on the slider. |
| 59 | + |
| 60 | +```html |
| 61 | +<md-slider value="24"></md-slider> |
| 62 | +``` |
| 63 | + |
| 64 | +### Slider with Step |
| 65 | + |
| 66 | +`md-slider` can have the step defined which declares where the thumb can snap to. |
| 67 | + |
| 68 | +```html |
| 69 | +<md-slider step="5"></md-slider> |
| 70 | +``` |
| 71 | + |
| 72 | +### Slider with Tick Interval |
| 73 | + |
| 74 | +`md-slider` can have a tick interval set to a number or to `auto`. |
| 75 | +`auto` will automatically draw tick marks on steps that are at least 30px apart and will always draw |
| 76 | +tick marks at the beginning and end of the slider. |
| 77 | +Setting `tick-interval` to a number will draw a tick mark at every `tick-interval` steps. An example |
| 78 | +of this is a `tick-interval` of `3` with a `step` of `4` will draw tick marks at every `3` steps, |
| 79 | +which is the same as every `12` values. |
| 80 | + |
| 81 | +```html |
| 82 | +<md-slider tick-interval="auto"></md-slider> |
| 83 | +<md-slider tick-interval="3" step="4"></md-slider> |
| 84 | +``` |
| 85 | + |
| 86 | +## `<md-slider>` |
| 87 | + |
| 88 | +### Bound Properties |
| 89 | + |
| 90 | +| Name | Type | Description | |
| 91 | +| --- | --- | --- | |
| 92 | +| `min` | number | Optional, the minimum number for the slider. Default = `0`. | |
| 93 | +| `max` | number | Optional, the maximum number for the slider. Default = `100`. | |
| 94 | +| `value` | number | Optional, the value to start the slider at. | |
| 95 | +| `tick-interval` | `"auto" | number` | Optional, how many steps between tick marks. | |
| 96 | +| `step` | number | Optional, declares where the thumb will snap to. Default = `1`. | |
| 97 | +| `disabled` | boolean | Optional, whether or not the slider is disabled. Default = `false`. | |
0 commit comments