You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: docs/pages/api-docs/slider-unstyled.md
+31Lines changed: 31 additions & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -29,6 +29,7 @@ You can learn more about the difference by [reading this guide](/guides/minimizi
29
29
| <spanclass="prop-name">aria-label</span> | <spanclass="prop-type">string</span> || The label of the slider. |
30
30
| <spanclass="prop-name">aria-labelledby</span> | <spanclass="prop-type">string</span> || The id of the element containing a label for the slider. |
31
31
| <spanclass="prop-name">aria-valuetext</span> | <spanclass="prop-type">string</span> || A string value that provides a user-friendly name for the current value of the slider. |
32
+
| <spanclass="prop-name">classes</span> | <spanclass="prop-type">object</span> || Override or extend the styles applied to the component. See [CSS API](#css) below for more details. |
32
33
| <spanclass="prop-name">color</span> | <spanclass="prop-type">'primary'<br>| 'secondary'</span> | <spanclass="prop-default">'primary'</span> | The color of the component. It supports those theme colors that make sense for this component. |
33
34
| <spanclass="prop-name">component</span> | <spanclass="prop-type">elementType</span> | <spanclass="prop-default">'span'</span> | The component used for the root node. Either a string to use a HTML element or a component. |
34
35
| <spanclass="prop-name">components</span> | <spanclass="prop-type">{ Mark?: elementType, MarkLabel?: elementType, Rail?: elementType, Root?: elementType, Thumb?: elementType, Track?: elementType, ValueLabel?: elementType }</span> | <spanclass="prop-default">{}</span> | The components used for each slot inside the Slider. Either a string to use a HTML element or a component. |
@@ -56,6 +57,36 @@ The `ref` is forwarded to the root element.
56
57
57
58
Any other props supplied will be provided to the root element (native element).
58
59
60
+
## CSS
61
+
62
+
| Rule name | Global class | Description |
63
+
|:-----|:-------------|:------------|
64
+
| <spanclass="prop-name">root</span> | <spanclass="prop-name">.root-1</span> | Class name applied to the root element.
65
+
| <spanclass="prop-name">colorPrimary</span> | <spanclass="prop-name">.colorPrimary-2</span> | Class name applied to the root element if `color="primary"`.
66
+
| <spanclass="prop-name">colorSecondary</span> | <spanclass="prop-name">.colorSecondary-3</span> | Class name applied to the root element if `color="secondary"`.
67
+
| <spanclass="prop-name">marked</span> | <spanclass="prop-name">.marked-4</span> | Class name applied to the root element if `marks` is provided with at least one label.
68
+
| <spanclass="prop-name">vertical</span> | <spanclass="prop-name">.vertical-5</span> | Class name applied to the root element if `orientation="vertical"`.
69
+
| <spanclass="prop-name">disabled</span> | <spanclass="prop-name">.disabled-6</span> | Pseudo-class applied to the root and thumb element if `disabled={true}`.
70
+
| <spanclass="prop-name">rail</span> | <spanclass="prop-name">.rail-7</span> | Class name applied to the rail element.
71
+
| <spanclass="prop-name">track</span> | <spanclass="prop-name">.track-8</span> | Class name applied to the track element.
72
+
| <spanclass="prop-name">trackFalse</span> | <spanclass="prop-name">.trackFalse-9</span> | Class name applied to the track element if `track={false}`.
73
+
| <spanclass="prop-name">trackInverted</span> | <spanclass="prop-name">.trackInverted-10</span> | Class name applied to the track element if `track="inverted"`.
74
+
| <spanclass="prop-name">thumb</span> | <spanclass="prop-name">.thumb-11</span> | Class name applied to the thumb element.
75
+
| <spanclass="prop-name">thumbColorPrimary</span> | <spanclass="prop-name">.thumbColorPrimary-12</span> | Class name applied to the thumb element if `color="primary"`.
76
+
| <spanclass="prop-name">thumbColorSecondary</span> | <spanclass="prop-name">.thumbColorSecondary-13</span> | Class name applied to the thumb element if `color="secondary"`.
77
+
| <spanclass="prop-name">active</span> | <spanclass="prop-name">.active-14</span> | Pseudo-class applied to the thumb element if it's active.
78
+
| <spanclass="prop-name">focusVisible</span> | <spanclass="prop-name">.focusVisible-15</span> | Pseudo-class applied to the thumb element if keyboard focused.
79
+
| <spanclass="prop-name">valueLabel</span> | <spanclass="prop-name">.valueLabel-16</span> | Class name applied to the thumb label element.
80
+
| <spanclass="prop-name">mark</span> | <spanclass="prop-name">.mark-17</span> | Class name applied to the mark element.
81
+
| <spanclass="prop-name">markActive</span> | <spanclass="prop-name">.markActive-18</span> | Class name applied to the mark element if active (depending on the value).
82
+
| <spanclass="prop-name">markLabel</span> | <spanclass="prop-name">.markLabel-19</span> | Class name applied to the mark label element.
83
+
| <spanclass="prop-name">markLabelActive</span> | <spanclass="prop-name">.markLabelActive-20</span> | Class name applied to the mark label element if active (depending on the value).
84
+
85
+
You can override the style of the component thanks to one of these customization points:
86
+
87
+
- With a [global class name](/guides/interoperability/#global-css).
88
+
- With a rule name as part of the component's [`styleOverrides` property](/customization/components/#global-theme-override) in a custom theme.
Copy file name to clipboardExpand all lines: docs/pages/api-docs/slider.md
+1Lines changed: 1 addition & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -31,6 +31,7 @@ The `MuiSlider` name can be used for providing [default props](/customization/gl
31
31
| <spanclass="prop-name">aria-label</span> | <spanclass="prop-type">string</span> || The label of the slider. |
32
32
| <spanclass="prop-name">aria-labelledby</span> | <spanclass="prop-type">string</span> || The id of the element containing a label for the slider. |
33
33
| <spanclass="prop-name">aria-valuetext</span> | <spanclass="prop-type">string</span> || A string value that provides a user-friendly name for the current value of the slider. |
34
+
| <spanclass="prop-name">classes</span> | <spanclass="prop-type">object</span> || Override or extend the styles applied to the component. See [CSS API](#css) below for more details. |
34
35
| <spanclass="prop-name">color</span> | <spanclass="prop-type">'primary'<br>| 'secondary'</span> || The color of the component. It supports those theme colors that make sense for this component. |
35
36
| <spanclass="prop-name">components</span> | <spanclass="prop-type">{ Mark?: elementType, MarkLabel?: elementType, Rail?: elementType, Root?: elementType, Thumb?: elementType, Track?: elementType, ValueLabel?: elementType }</span> | <spanclass="prop-default">{}</span> | The components used for each slot inside the Slider. Either a string to use a HTML element or a component. |
36
37
| <spanclass="prop-name">componentsProps</span> | <spanclass="prop-type">object</span> || The props used for each slot inside the Slider. |
- The `classes` prop is no longer available for styling the component. You can fix this by one of these options:
755
-
756
-
1. Move these overrides to the theme's components overrides section
757
-
758
-
```diff
759
-
- const useStyles = makeStyles({
760
-
- root: {
761
-
- margin: '10px',
762
-
- },
763
-
- colorPrimary: {
764
-
- backgroundColor: '#232323',
765
-
- }
766
-
- });
767
-
+ const theme = createMuiTheme({
768
-
+ components: {
769
-
+ MuiSlider: {
770
-
+ styleOverrides: {
771
-
+ root: {
772
-
+ margin: '10px',
773
-
+ },
774
-
+ colorPrimary: {
775
-
+ backgroundColor: '#232323',
776
-
+ },
777
-
+ },
778
-
+ },
779
-
+ },
780
-
+ });
781
-
// ...
782
-
- const classes = useStyles();
783
-
// ...
784
-
+ <ThemeProvider theme={theme}>
785
-
// ...
786
-
- <Slider classes={classes}>
787
-
+ <Slider />
788
-
```
789
-
790
-
or 2. you can follow one of the overrides approach described on the ([Style Library Interoperability](/guides/interoperability/)) page. The class names for the Slider component can be find on the [API page](/api/slider/#css).
791
-
792
754
### Snackbar
793
755
794
756
- The notification now displays at the bottom left on large screens.
0 commit comments