@@ -146,11 +146,14 @@ These styles can be used as the `$style` argument for the `mdc-typography` mixin
146
146
147
147
#### Overriding Styles
148
148
149
- All styles can be overridden using CSS custom properties or Sass global variables.
149
+ All styles can be overridden using CSS custom properties or Sass module/ global variables.
150
150
151
- When using Sass global variables, they must be defined _ before_ the component is imported by setting a global
152
- variable named ` $mdc-typography-styles-{style} ` . The variable should be assigned a map that contains all the properties
153
- you want to override for a particular style.
151
+ When using Sass ** module** variables, the module must be configured _ before_ any other ` @use `
152
+ statements with a variable named ` $styles-{style} ` . The variable should be assigned to a map
153
+ that contains all the properties you want to override for a particular style.
154
+
155
+ When using Sass ** global** variables, they must be defined _ before_ the component is imported by setting a global
156
+ variable named ` $mdc-typography-styles-{style} ` .
154
157
155
158
** Example:** Overriding the button ` font-size ` and ` text-transform ` properties.
156
159
@@ -163,6 +166,20 @@ html {
163
166
}
164
167
```
165
168
169
+ Sass module variables:
170
+
171
+ ``` scss
172
+ @use " @material/typography" with (
173
+ $styles-button : (
174
+ font-size : 16px ,
175
+ text-transform : none ,
176
+ )
177
+ );
178
+
179
+ @use " @material/button" ;
180
+ @include button .core-styles ;
181
+ ```
182
+
166
183
Sass global variables:
167
184
168
185
``` scss
@@ -171,7 +188,7 @@ $mdc-typography-styles-button: (
171
188
text-transform : none ,
172
189
);
173
190
174
- @use " @material/button/mdc-button" ;
191
+ @import " @material/button/mdc-button" ;
175
192
```
176
193
177
194
** Example:** Overriding the global ` font-family ` property.
@@ -184,13 +201,23 @@ html {
184
201
}
185
202
```
186
203
204
+ Sass module variables:
205
+
206
+ ``` scss
207
+ @use " @material/typography" with (
208
+ $font-family : unquote (" Arial, Helvetica, sans-serif" )
209
+ );
210
+
211
+ @use " @material/button" ;
212
+ @include button .core-styles ;
213
+ ```
214
+
187
215
Sass global variables:
188
216
189
217
``` scss
190
218
$mdc-typography-font-family : unquote (" Arial, Helvetica, sans-serif" );
191
219
192
- ...
193
- @use ...
220
+ @import " @material/button/mdc-button" ;
194
221
```
195
222
196
223
** Example:** Overriding the ` font-family ` property for ` headline1 ` and ` font-family ` and ` font-size ` for ` headline2 ` .
@@ -205,6 +232,22 @@ html {
205
232
}
206
233
```
207
234
235
+ Sass module variables:
236
+
237
+ ``` scss
238
+ @use " @material/typography" with (
239
+ $styles-headline1 : (
240
+ $font-family : unquote (" Arial, Helvetica, sans-serif" )
241
+ ),
242
+ $styles-headline2 : (
243
+ $font-family : unquote (" Arial, Helvetica, sans-serif" ),
244
+ $font-size : 3.25rem
245
+ )
246
+ );
247
+
248
+ @use ...
249
+ ```
250
+
208
251
Sass global variables :
209
252
210
253
```scss
@@ -216,6 +259,5 @@ $mdc-typography-styles-headline2: (
216
259
font-size : 3.25rem
217
260
);
218
261
219
- ...
220
- @use ...
262
+ @import ...
221
263
```
0 commit comments