|
| 1 | +--- |
| 2 | +title: Appearance |
| 3 | +page_title: Appearance |
| 4 | +description: "Learn how to customize the appearance of the Telerik UI Slider HtmlHelper for {{ site.framework }}." |
| 5 | +slug: slider_appearance |
| 6 | +position: 2 |
| 7 | +--- |
| 8 | + |
| 9 | +# Slider Appearance |
| 10 | + |
| 11 | +> As of the R1 2022 release, the Slider uses a brand new rendering. |
| 12 | +
|
| 13 | +In this article, you will find information about the new rendering of the {{ site.product }} Slider. |
| 14 | + |
| 15 | +For additional information regarding the decision behind these changes, visit the [Components Rendering](https://docs.telerik.com/{{ site.platform }}/styles-and-layout/components-rendering-overview) article. |
| 16 | + |
| 17 | +## Old vs New Rendering |
| 18 | + |
| 19 | +The old rendering of the component consisted of the following elements: |
| 20 | + |
| 21 | +- The outer `div` wrapper with the `k-slider` class: |
| 22 | + ```html |
| 23 | + <div class="k-widget k-slider"> |
| 24 | + </div> |
| 25 | + ``` |
| 26 | + |
| 27 | +- The `div` element with `k-slider-wrap` class holding the slider items and the increasing and decreasing buttons: |
| 28 | + ```html |
| 29 | + <div class="k-slider-wrap k-slider-buttons"> |
| 30 | + </div> |
| 31 | + ``` |
| 32 | + |
| 33 | +- The `a` element for the **Increase** button with the `k-button-increase` class. This element is a child of the `k-slider-wrap` `div` element: |
| 34 | + ```html |
| 35 | + <a role="button" class="k-button k-button-increase" title="Increase"> |
| 36 | + <span class="k-icon k-i-arrow-60-right"></span> |
| 37 | + </a> |
| 38 | + ``` |
| 39 | + |
| 40 | +- The `a` element for the **Decrease** button with the `k-button-decrease` class. This element is a child of the `k-slider-wrap` `div` element: |
| 41 | + ```html |
| 42 | + <a role="button" class="k-button k-button-decrease" title="Decrease"> |
| 43 | + <span class="k-icon k-i-arrow-60-left"></span> |
| 44 | + </a> |
| 45 | + ``` |
| 46 | + |
| 47 | +- The `ul` element with `k-slider-items` class holding information about the Slider ticks. This element is a child of the `k-slider-wrap` `div` element: |
| 48 | + ```html |
| 49 | + <ul class="k-reset k-slider-items" role="presentation"> |
| 50 | + ..... |
| 51 | + </ul> |
| 52 | + ``` |
| 53 | + |
| 54 | +- The `div` element with `k-slider-track` class holding information about the Slider selection. This element is a child of the `k-slider-wrap` `div` element: |
| 55 | + ```html |
| 56 | + <ul class="k-reset k-slider-items" role="presentation"> |
| 57 | + ..... |
| 58 | + </ul> |
| 59 | + ``` |
| 60 | + |
| 61 | +The following example demonstrates the full version of the old rendering: |
| 62 | +```html |
| 63 | + <div class="k-widget k-slider"> |
| 64 | + <div class="k-slider-wrap k-slider-buttons"> |
| 65 | + |
| 66 | + <a role="button" class="k-button k-button-increase" title="Increase" aria-label="Increase"> |
| 67 | + <span class="k-icon k-i-arrow-60-right"></span> |
| 68 | + </a> |
| 69 | + |
| 70 | + <a role="button" class="k-button k-button-decrease" title="Decrease" aria-label="Decrease"> |
| 71 | + <span class="k-icon k-i-arrow-60-left"></span> |
| 72 | + </a> |
| 73 | + |
| 74 | + <ul class="k-reset k-slider-items" role="presentation"> |
| 75 | + ..... |
| 76 | + </ul> |
| 77 | + |
| 78 | + <div class="k-slider-track"> |
| 79 | + ..... |
| 80 | + </div> |
| 81 | + |
| 82 | + <input id="slider" type="text" data-role="slider"> |
| 83 | + </div> |
| 84 | + </div> |
| 85 | +``` |
| 86 | + |
| 87 | +The new rendering of the component consists of a single wrapping `span` element that contains the child `input` and `button` elements. |
| 88 | + |
| 89 | +With the new rendering additional classes are applied to the **Increase** and **Decrease** buttons inside the Slider. For additional information regarding the new button rendering, visit the [Button Styling]({% slug button_appearance %}) article. |
| 90 | + |
| 91 | +The new rendering of the Slider component consists of the following elements: |
| 92 | + |
| 93 | +- The outer `div` wrapper with the `k-slider` class: |
| 94 | + ```html |
| 95 | + <div class="k-widget k-slider"> |
| 96 | + </div> |
| 97 | + ``` |
| 98 | + |
| 99 | +- The `a` button element for the **Decrease** button with the `k-button-decrease` class. This element is now a direct child of the `k-slider` `div` element: |
| 100 | + ```html |
| 101 | + <a role="button" class="k-button k-button-md k-rounded-full k-button-solid k-button-solid-base k-icon-button k-button-decrease" title="Decrease" aria-label="Decrease"> |
| 102 | + <span class="k-button-icon k-icon k-i-arrow-w"></span> |
| 103 | + </a> |
| 104 | + ``` |
| 105 | + |
| 106 | +- The `div` element with the `k-slider-track-wrap` class, which holds information about the Slider items and selection. This element is a child of the `k-slider` `div` element: |
| 107 | + ```html |
| 108 | + <div class="k-slider-track-wrap"> |
| 109 | + </div> |
| 110 | + ``` |
| 111 | + |
| 112 | +- The `a` element for the **Increase** button with the `k-button-increase` class. This element is now a direct child of the `k-slider` `div` element: |
| 113 | + ```html |
| 114 | + <a role="button" class="k-button k-button-md k-rounded-full k-button-solid k-button-solid-base k-icon-button k-button-increase" title="Increase" aria-label="Increase"> |
| 115 | + <span class="k-button-icon k-icon k-i-arrow-e"></span> |
| 116 | + </a> |
| 117 | + ``` |
| 118 | + |
| 119 | +- The `ul` element with the `k-slider-items` class, which holds information about the Slider ticks. This element is now a child of the `k-slider-track-wrap` `div` element: |
| 120 | + ```html |
| 121 | + <ul class="k-reset k-slider-items" role="presentation"> |
| 122 | + ..... |
| 123 | + </ul> |
| 124 | + ``` |
| 125 | + |
| 126 | +- The `div` element with the `k-slider-track` class, which holds information about the Slider selection. This element is now a child of the `k-slider-track-wrap` `div` element: |
| 127 | + ```html |
| 128 | + <ul class="k-reset k-slider-items" role="presentation"> |
| 129 | + ..... |
| 130 | + </ul> |
| 131 | + ``` |
| 132 | +The following example demonstrates the full version of the new rendering: |
| 133 | + |
| 134 | +```html |
| 135 | + <div class="k-widget k-slider"> |
| 136 | + |
| 137 | + <a role="button" class="k-button k-button-md k-rounded-full k-button-solid k-button-solid-base k-icon-button k-button-decrease" title="Decrease" aria-label="Decrease"> |
| 138 | + <span class="k-button-icon k-icon k-i-arrow-w"></span> |
| 139 | + </a> |
| 140 | + |
| 141 | + <div class="k-slider-track-wrap"> |
| 142 | + <ul class="k-reset k-slider-items" role="presentation"> |
| 143 | + ..... |
| 144 | + </ul> |
| 145 | + <div class="k-slider-track"> |
| 146 | + .... |
| 147 | + </div> |
| 148 | + <input id="slider" type="text" data-role="slider" > |
| 149 | + </div> |
| 150 | + |
| 151 | + <a role="button" class="k-button k-button-md k-rounded-full k-button-solid k-button-solid-base k-icon-button k-button-increase" title="Increase" aria-label="Increase"> |
| 152 | + <span class="k-button-icon k-icon k-i-arrow-e"></span> |
| 153 | + </a> |
| 154 | + |
| 155 | + </div> |
| 156 | +``` |
| 157 | + |
| 158 | + |
| 159 | +## Visual Backwards Compatibility |
| 160 | + |
| 161 | +> When a LESS theme is used, the new styling and rendering support only the [default options](#options). |
| 162 | +
|
| 163 | +Previously, the **Increase** button in the DOM was rendered before the **Decrease** button. |
| 164 | + |
| 165 | +```javascript |
| 166 | +$('.k-slider .k-button')[0] // Returns a reference to the increase button in the old rendering. |
| 167 | +$('.k-slider .k-button')[1] // Returns a reference to the decrease button in the old rendering. |
| 168 | +``` |
| 169 | + |
| 170 | +With the new rendering, the **Increase** button in the DOM is rendered after the **Decrease** button. |
| 171 | + |
| 172 | +```javascript |
| 173 | +$('.k-slider .k-button')[0] // Returns a reference to the decrease button in the new rendering. |
| 174 | +$('.k-slider .k-button')[1] // Returns a reference to the increase button in the new rendering. |
| 175 | +``` |
| 176 | + |
| 177 | +Both in the old and new rendering, you can also reference the **Increase** and **Decrease** buttons by using the `k-button-increase` and `k-button-decrease` classes respectively. |
| 178 | +```javascript |
| 179 | +$('.k-button-increase') // Returns a reference to the increase button. |
| 180 | +$('.k-button-decrease') // Returns a reference to the decrease button. |
| 181 | +``` |
| 182 | + |
| 183 | +## See Also |
| 184 | + |
| 185 | +* [Appearance of the Button HtmlHelper for {{ site.framework }} (Demo)](https://demos.telerik.com/{{ site.platform }}/button/appearance) |
| 186 | +* [Slider Server-Side API](/api/slider) |
| 187 | +* [Slider Client-Side API](https://docs.telerik.com/kendo-ui/api/javascript/ui/slider) |
| 188 | + |
| 189 | + |
0 commit comments