@fluentui/react-text 9.1.3 → 9.1.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.json +54 -4
- package/CHANGELOG.md +25 -5
- package/README.md +2 -4
- package/lib/Body1.js.map +1 -1
- package/lib/Caption1.js.map +1 -1
- package/lib/Caption2.js.map +1 -1
- package/lib/Display.js.map +1 -1
- package/lib/LargeTitle.js.map +1 -1
- package/lib/Subtitle1.js.map +1 -1
- package/lib/Subtitle2.js.map +1 -1
- package/lib/Text.js.map +1 -1
- package/lib/Title1.js.map +1 -1
- package/lib/Title2.js.map +1 -1
- package/lib/Title3.js.map +1 -1
- package/lib/components/Body1/Body1.js.map +1 -1
- package/lib/components/Body1/index.js.map +1 -1
- package/lib/components/Caption1/Caption1.js.map +1 -1
- package/lib/components/Caption1/index.js.map +1 -1
- package/lib/components/Caption2/Caption2.js.map +1 -1
- package/lib/components/Caption2/index.js.map +1 -1
- package/lib/components/Display/Display.js.map +1 -1
- package/lib/components/Display/index.js.map +1 -1
- package/lib/components/LargeTitle/LargeTitle.js.map +1 -1
- package/lib/components/LargeTitle/index.js.map +1 -1
- package/lib/components/Subtitle1/Subtitle1.js.map +1 -1
- package/lib/components/Subtitle1/index.js.map +1 -1
- package/lib/components/Subtitle2/Subtitle2.js.map +1 -1
- package/lib/components/Subtitle2/index.js.map +1 -1
- package/lib/components/Text/Text.js.map +1 -1
- package/lib/components/Text/Text.types.js.map +1 -1
- package/lib/components/Text/index.js.map +1 -1
- package/lib/components/Text/renderText.js.map +1 -1
- package/lib/components/Text/useText.js.map +1 -1
- package/lib/components/Text/useTextStyles.js.map +1 -1
- package/lib/components/Title1/Title1.js.map +1 -1
- package/lib/components/Title1/index.js.map +1 -1
- package/lib/components/Title2/Title2.js.map +1 -1
- package/lib/components/Title2/index.js.map +1 -1
- package/lib/components/Title3/Title3.js.map +1 -1
- package/lib/components/Title3/index.js.map +1 -1
- package/lib/components/wrapper.js.map +1 -1
- package/lib/index.js.map +1 -1
- package/lib-commonjs/Body1.js.map +1 -1
- package/lib-commonjs/Caption1.js.map +1 -1
- package/lib-commonjs/Caption2.js.map +1 -1
- package/lib-commonjs/Display.js.map +1 -1
- package/lib-commonjs/LargeTitle.js.map +1 -1
- package/lib-commonjs/Subtitle1.js.map +1 -1
- package/lib-commonjs/Subtitle2.js.map +1 -1
- package/lib-commonjs/Text.js.map +1 -1
- package/lib-commonjs/Title1.js.map +1 -1
- package/lib-commonjs/Title2.js.map +1 -1
- package/lib-commonjs/Title3.js.map +1 -1
- package/lib-commonjs/components/Body1/Body1.js.map +1 -1
- package/lib-commonjs/components/Body1/index.js.map +1 -1
- package/lib-commonjs/components/Caption1/Caption1.js.map +1 -1
- package/lib-commonjs/components/Caption1/index.js.map +1 -1
- package/lib-commonjs/components/Caption2/Caption2.js.map +1 -1
- package/lib-commonjs/components/Caption2/index.js.map +1 -1
- package/lib-commonjs/components/Display/Display.js.map +1 -1
- package/lib-commonjs/components/Display/index.js.map +1 -1
- package/lib-commonjs/components/LargeTitle/LargeTitle.js.map +1 -1
- package/lib-commonjs/components/LargeTitle/index.js.map +1 -1
- package/lib-commonjs/components/Subtitle1/Subtitle1.js.map +1 -1
- package/lib-commonjs/components/Subtitle1/index.js.map +1 -1
- package/lib-commonjs/components/Subtitle2/Subtitle2.js.map +1 -1
- package/lib-commonjs/components/Subtitle2/index.js.map +1 -1
- package/lib-commonjs/components/Text/Text.js.map +1 -1
- package/lib-commonjs/components/Text/index.js.map +1 -1
- package/lib-commonjs/components/Text/renderText.js.map +1 -1
- package/lib-commonjs/components/Text/useText.js.map +1 -1
- package/lib-commonjs/components/Text/useTextStyles.js.map +1 -1
- package/lib-commonjs/components/Title1/Title1.js.map +1 -1
- package/lib-commonjs/components/Title1/index.js.map +1 -1
- package/lib-commonjs/components/Title2/Title2.js.map +1 -1
- package/lib-commonjs/components/Title2/index.js.map +1 -1
- package/lib-commonjs/components/Title3/Title3.js.map +1 -1
- package/lib-commonjs/components/Title3/index.js.map +1 -1
- package/lib-commonjs/components/wrapper.js.map +1 -1
- package/lib-commonjs/index.js.map +1 -1
- package/package.json +10 -10
- package/MIGRATION.md +0 -730
- package/Spec.md +0 -162
- package/assets/typography-examples.gif +0 -0
package/MIGRATION.md
DELETED
@@ -1,730 +0,0 @@
|
|
1
|
-
# Text Migration
|
2
|
-
|
3
|
-
## Introduction
|
4
|
-
|
5
|
-
This guide is a reference for upgrading from v7 (Fabric) or v0 (Northstar) into v9 (Fluent UI / converged).
|
6
|
-
|
7
|
-
## Property mapping
|
8
|
-
|
9
|
-
Below you'll find a table with the relations between the properties of Fabric/Northstar and the converged version of Text to make it clear for you which properties require changes or are deprecated with the new version.
|
10
|
-
|
11
|
-
> ⚠️ Note - Properties not in this table are considered deprecated.
|
12
|
-
> You can find how to migrate them below.
|
13
|
-
|
14
|
-
| v8 (Fabric) | v0 (Northstar) | v9 (Fluent UI) | Good to go? |
|
15
|
-
| ----------- | -------------- | -------------- | ----------- |
|
16
|
-
| as | as | as | ✔️ |
|
17
|
-
| className | className | className | ✔️ |
|
18
|
-
| variant | size | size | ⚠️ |
|
19
|
-
| block | - | block | ✔️ |
|
20
|
-
| nowrap | - | wrap | ⚠️ |
|
21
|
-
| - | align | align | ✔️ |
|
22
|
-
| - | content | children | ⚠️ |
|
23
|
-
| - | styles | styles | ✔️ |
|
24
|
-
| - | truncated | truncate | ⚠️ |
|
25
|
-
| - | weight | weight | ⚠️ |
|
26
|
-
|
27
|
-
---
|
28
|
-
|
29
|
-
## Migration from v8 (Fabric)
|
30
|
-
|
31
|
-
### as
|
32
|
-
|
33
|
-
_This property suffered no changes and can be left as is._
|
34
|
-
|
35
|
-
### block
|
36
|
-
|
37
|
-
_This property suffered no changes and can be left as is._
|
38
|
-
|
39
|
-
### className
|
40
|
-
|
41
|
-
_This property suffered no changes and can be left as is._
|
42
|
-
|
43
|
-
### nowrap
|
44
|
-
|
45
|
-
The `nowrap` property was changed to `wrap` and it is `true` by default. You can achieve the same result as `nowrap` by using:
|
46
|
-
|
47
|
-
```tsx
|
48
|
-
<Text wrap={false}>Not wrapped</Text>
|
49
|
-
```
|
50
|
-
|
51
|
-
### variant
|
52
|
-
|
53
|
-
Variants are now represented with tokens that you can override on a theme level. These are the token sizes for the default theme:
|
54
|
-
|
55
|
-
<h4 id="size-table">Fluent UI size tokens</h4>
|
56
|
-
|
57
|
-
| Token | font-size | line-height |
|
58
|
-
| ----- | --------- | ----------- |
|
59
|
-
| 100 | 10px | 14px |
|
60
|
-
| 200 | 12px | 16px |
|
61
|
-
| 300 | 14px | 20px |
|
62
|
-
| 400 | 16px | 22px |
|
63
|
-
| 500 | 20px | 28px |
|
64
|
-
| 600 | 24px | 32px |
|
65
|
-
| 700 | 28px | 36px |
|
66
|
-
| 800 | 32px | 40px |
|
67
|
-
| 900 | 40px | 52px |
|
68
|
-
| 1000 | 68px | 92px |
|
69
|
-
|
70
|
-
You can use them with Text as such:
|
71
|
-
|
72
|
-
```tsx
|
73
|
-
<Text size={300}>Text</Text>
|
74
|
-
```
|
75
|
-
|
76
|
-
---
|
77
|
-
|
78
|
-
## Migration from v0 (Northstar)
|
79
|
-
|
80
|
-
> ⚠️ Note - The Teams specific functionality will only be partially covered in this guide.
|
81
|
-
> Given that most properties depend on Teams design tokens and there is yet no relationship table created for Teams to Fluent UI tokens, only the absolute values and Northstar token names will be provided.
|
82
|
-
|
83
|
-
### as
|
84
|
-
|
85
|
-
_This property suffered no changes and can be left as is._
|
86
|
-
|
87
|
-
### truncated
|
88
|
-
|
89
|
-
To achieve the same result with the new `truncate` property, you'll need to do the following:
|
90
|
-
|
91
|
-
```tsx
|
92
|
-
<Text block truncate wrap={false}>
|
93
|
-
Not wrapped
|
94
|
-
</Text>
|
95
|
-
```
|
96
|
-
|
97
|
-
This is due to `truncate` changing the CSS property `text-overflow` to `ellipsis`.
|
98
|
-
Since `text-overflow` doesn't force an overflow to occur, properties `overflow` and `white-space` also need to be set. These two are set by the `wrap` property when set as `false`.
|
99
|
-
Finally, `block` is required as `Text` is now displayed as `inline` by default and without it the container will grow according to the content.
|
100
|
-
|
101
|
-
_Read more about the CSS props:_
|
102
|
-
|
103
|
-
- _[text-overflow](https://developer.mozilla.org/en-US/docs/Web/CSS/text-overflow)_
|
104
|
-
- _[overflow](https://developer.mozilla.org/en-US/docs/Web/CSS/overflow)_
|
105
|
-
- _[white-space](https://developer.mozilla.org/en-US/docs/Web/CSS/white-space)_
|
106
|
-
- _[display](https://developer.mozilla.org/en-US/docs/Web/CSS/display)_
|
107
|
-
|
108
|
-
### size
|
109
|
-
|
110
|
-
While the name remains the same, the values are now represented with integer tokens that you can override on a theme level. Please refer to the [Fluent UI size table](#size-table) above for more information about the absolute values for the tokens.
|
111
|
-
|
112
|
-
You can use them with Text as such:
|
113
|
-
|
114
|
-
```tsx
|
115
|
-
<Text size={300}>Text</Text>
|
116
|
-
```
|
117
|
-
|
118
|
-
### align
|
119
|
-
|
120
|
-
_This property suffered no changes and can be left as is._
|
121
|
-
|
122
|
-
### atMention [DEPRECATED]
|
123
|
-
|
124
|
-
This property was deprecated. Given that this property depends on the applied style, you can find below examples on how to achieve the same results in the default, dark and high contrast themes:
|
125
|
-
|
126
|
-
#### Using `atMention` / `atMention={true}`
|
127
|
-
|
128
|
-
##### **teamsTheme**
|
129
|
-
|
130
|
-
Northstar design tokens:
|
131
|
-
|
132
|
-
- Color: `siteVariables.colors.brand[600]`
|
133
|
-
|
134
|
-
```tsx
|
135
|
-
import { makeStyles, Text } from '@fluentui/react-components';
|
136
|
-
|
137
|
-
const useStyles = makeStyles({
|
138
|
-
root: {
|
139
|
-
color: 'rgb(98, 100, 167)',
|
140
|
-
},
|
141
|
-
});
|
142
|
-
|
143
|
-
const MyComponent = () => {
|
144
|
-
const styles = useStyles();
|
145
|
-
|
146
|
-
return <Text className={styles.root}>{/* ... */}</Text>;
|
147
|
-
};
|
148
|
-
```
|
149
|
-
|
150
|
-
##### **teamsDarkTheme**
|
151
|
-
|
152
|
-
Northstar design tokens:
|
153
|
-
|
154
|
-
- Color: `siteVariables.colors.brand[400]`
|
155
|
-
|
156
|
-
```tsx
|
157
|
-
import { makeStyles, Text } from '@fluentui/react-components';
|
158
|
-
|
159
|
-
const useStyles = makeStyles({
|
160
|
-
root: {
|
161
|
-
color: 'rgb(166, 167, 220)',
|
162
|
-
},
|
163
|
-
});
|
164
|
-
|
165
|
-
const MyComponent = () => {
|
166
|
-
const styles = useStyles();
|
167
|
-
|
168
|
-
return <Text className={styles.root}>{/* ... */}</Text>;
|
169
|
-
};
|
170
|
-
```
|
171
|
-
|
172
|
-
##### **teamsHighContrastTheme**
|
173
|
-
|
174
|
-
Northstar design tokens:
|
175
|
-
|
176
|
-
- Color: `siteVariables.accessibleYellow`
|
177
|
-
|
178
|
-
```tsx
|
179
|
-
import { makeStyles, Text } from '@fluentui/react-components';
|
180
|
-
|
181
|
-
const useStyles = makeStyles({
|
182
|
-
root: {
|
183
|
-
color: 'rgb(255, 255, 1)',
|
184
|
-
},
|
185
|
-
});
|
186
|
-
|
187
|
-
const MyComponent = () => {
|
188
|
-
const styles = useStyles();
|
189
|
-
|
190
|
-
return <Text className={styles.root}>{/* ... */}</Text>;
|
191
|
-
};
|
192
|
-
```
|
193
|
-
|
194
|
-
#### Using `atMention="me"`
|
195
|
-
|
196
|
-
##### **teamsTheme**
|
197
|
-
|
198
|
-
Northstar design tokens:
|
199
|
-
|
200
|
-
- Color: `siteVariables.colors.orange[400]`
|
201
|
-
- Font weight: `siteVariables.fontWeightBold`
|
202
|
-
|
203
|
-
```tsx
|
204
|
-
import { makeStyles, Text } from '@fluentui/react-components';
|
205
|
-
|
206
|
-
const useStyles = makeStyles({
|
207
|
-
root: {
|
208
|
-
color: 'rgb(204, 74, 49)',
|
209
|
-
fontWeight: 700,
|
210
|
-
},
|
211
|
-
});
|
212
|
-
|
213
|
-
const MyComponent = () => {
|
214
|
-
const styles = useStyles();
|
215
|
-
|
216
|
-
return <Text className={styles.root}>{/* ... */}</Text>;
|
217
|
-
};
|
218
|
-
```
|
219
|
-
|
220
|
-
##### **teamsDarkTheme**
|
221
|
-
|
222
|
-
Northstar design tokens:
|
223
|
-
|
224
|
-
- Color: `siteVariables.colors.orange[300]`
|
225
|
-
- Font weight: `siteVariables.fontWeightBold`
|
226
|
-
|
227
|
-
```tsx
|
228
|
-
import { makeStyles, Text } from '@fluentui/react-components';
|
229
|
-
|
230
|
-
const useStyles = makeStyles({
|
231
|
-
root: {
|
232
|
-
color: 'rgb(233, 117, 72)',
|
233
|
-
fontWeight: 700,
|
234
|
-
},
|
235
|
-
});
|
236
|
-
|
237
|
-
const MyComponent = () => {
|
238
|
-
const styles = useStyles();
|
239
|
-
|
240
|
-
return <Text className={styles.root}>{/* ... */}</Text>;
|
241
|
-
};
|
242
|
-
```
|
243
|
-
|
244
|
-
##### **teamsHighContrastTheme**
|
245
|
-
|
246
|
-
Northstar design tokens:
|
247
|
-
|
248
|
-
- Color: `siteVariables.accessibleYellow`
|
249
|
-
- Font weight: `siteVariables.fontWeightBold`
|
250
|
-
|
251
|
-
```tsx
|
252
|
-
import { makeStyles, Text } from '@fluentui/react-components';
|
253
|
-
|
254
|
-
const useStyles = makeStyles({
|
255
|
-
root: {
|
256
|
-
color: 'rgb(255, 255, 1)',
|
257
|
-
fontWeight: 700,
|
258
|
-
},
|
259
|
-
});
|
260
|
-
|
261
|
-
const MyComponent = () => {
|
262
|
-
const styles = useStyles();
|
263
|
-
|
264
|
-
return <Text className={styles.root}>{/* ... */}</Text>;
|
265
|
-
};
|
266
|
-
```
|
267
|
-
|
268
|
-
### color
|
269
|
-
|
270
|
-
This property was deprecated. Below is a simple example on how to achieve the same result:
|
271
|
-
|
272
|
-
```tsx
|
273
|
-
import { makeStyles, Text } from '@fluentui/react-components';
|
274
|
-
|
275
|
-
const useStyles = makeStyles({
|
276
|
-
root: {
|
277
|
-
color: '__ put your color there __',
|
278
|
-
},
|
279
|
-
});
|
280
|
-
|
281
|
-
const MyComponent = () => {
|
282
|
-
const styles = useStyles();
|
283
|
-
|
284
|
-
return <Text className={styles.root}>{/* ... */}</Text>;
|
285
|
-
};
|
286
|
-
```
|
287
|
-
|
288
|
-
_Read more about the CSS prop: [color](https://developer.mozilla.org/en-US/docs/Web/CSS/color)_
|
289
|
-
|
290
|
-
### content
|
291
|
-
|
292
|
-
The `content` prop works the same way as the native `children` prop in React.
|
293
|
-
You can either use:
|
294
|
-
|
295
|
-
```tsx
|
296
|
-
<Text children="Hello World!" />
|
297
|
-
```
|
298
|
-
|
299
|
-
Or the common and recomended way:
|
300
|
-
|
301
|
-
```tsx
|
302
|
-
<Text>Hello World!</Text>
|
303
|
-
```
|
304
|
-
|
305
|
-
### disabled [DEPRECATED]
|
306
|
-
|
307
|
-
This property was deprecated. Given that this property depends on the applied style, you can find below examples on how to achieve the same results in the default, dark and high contrast themes:
|
308
|
-
|
309
|
-
#### **teamsTheme**
|
310
|
-
|
311
|
-
Northstar design tokens:
|
312
|
-
|
313
|
-
- Color: `siteVariables.colors.grey[250]`
|
314
|
-
|
315
|
-
```
|
316
|
-
import { makeStyles, Text } from '@fluentui/react-components';
|
317
|
-
|
318
|
-
const useStyles = makeStyles(theme => ({
|
319
|
-
root: {
|
320
|
-
color: 'rgb(200, 198, 196)'
|
321
|
-
},
|
322
|
-
})
|
323
|
-
|
324
|
-
const MyComponent = () => {
|
325
|
-
const styles = useStyles()
|
326
|
-
|
327
|
-
return <Text className={styles.root}>{...}</Text>
|
328
|
-
}
|
329
|
-
```
|
330
|
-
|
331
|
-
#### **teamsDarkTheme**
|
332
|
-
|
333
|
-
Northstar design tokens:
|
334
|
-
|
335
|
-
- Color: `siteVariables.colors.grey[450]`
|
336
|
-
|
337
|
-
```
|
338
|
-
import { makeStyles, Text } from '@fluentui/react-components';
|
339
|
-
|
340
|
-
const useStyles = makeStyles(theme => ({
|
341
|
-
root: {
|
342
|
-
color: 'rgb(96, 94, 92)'
|
343
|
-
},
|
344
|
-
})
|
345
|
-
|
346
|
-
const MyComponent = () => {
|
347
|
-
const styles = useStyles()
|
348
|
-
|
349
|
-
return <Text className={styles.root}>{...}</Text>
|
350
|
-
}
|
351
|
-
```
|
352
|
-
|
353
|
-
#### **teamsHighContrastTheme**
|
354
|
-
|
355
|
-
Northstar design tokens:
|
356
|
-
|
357
|
-
- Color: `siteVariables.accessibleGreen`
|
358
|
-
|
359
|
-
```
|
360
|
-
import { makeStyles, Text } from '@fluentui/react-components';
|
361
|
-
|
362
|
-
const useStyles = makeStyles(theme => ({
|
363
|
-
root: {
|
364
|
-
color: 'rgb(63, 242, 63)'
|
365
|
-
},
|
366
|
-
})
|
367
|
-
|
368
|
-
const MyComponent = () => {
|
369
|
-
const styles = useStyles()
|
370
|
-
|
371
|
-
return <Text className={styles.root}>{...}</Text>
|
372
|
-
}
|
373
|
-
```
|
374
|
-
|
375
|
-
### error [DEPRECATED]
|
376
|
-
|
377
|
-
This property was deprecated. Given that this property depends on the applied style, you can find below examples on how to achieve the same results in the default, dark and high contrast themes:
|
378
|
-
|
379
|
-
#### **teamsTheme**
|
380
|
-
|
381
|
-
Northstar design tokens:
|
382
|
-
|
383
|
-
- Color: `siteVariables.colorScheme.red.foreground`
|
384
|
-
|
385
|
-
```
|
386
|
-
import { makeStyles, Text } from '@fluentui/react-components';
|
387
|
-
|
388
|
-
const useStyles = makeStyles(theme => ({
|
389
|
-
root: {
|
390
|
-
color: 'rgb(196, 49, 75)'
|
391
|
-
},
|
392
|
-
})
|
393
|
-
|
394
|
-
const MyComponent = () => {
|
395
|
-
const styles = useStyles()
|
396
|
-
|
397
|
-
return <Text className={styles.root}>{...}</Text>
|
398
|
-
}
|
399
|
-
```
|
400
|
-
|
401
|
-
#### **teamsDarkTheme**
|
402
|
-
|
403
|
-
Northstar design tokens:
|
404
|
-
|
405
|
-
- Color: `siteVariables.colors.red[300]`
|
406
|
-
|
407
|
-
```
|
408
|
-
import { makeStyles, Text } from '@fluentui/react-components';
|
409
|
-
|
410
|
-
const useStyles = makeStyles(theme => ({
|
411
|
-
root: {
|
412
|
-
color: 'rgb(231, 53, 80)'
|
413
|
-
},
|
414
|
-
})
|
415
|
-
|
416
|
-
const MyComponent = () => {
|
417
|
-
const styles = useStyles()
|
418
|
-
|
419
|
-
return <Text className={styles.root}>{...}</Text>
|
420
|
-
}
|
421
|
-
```
|
422
|
-
|
423
|
-
#### **teamsHighContrastTheme**
|
424
|
-
|
425
|
-
Northstar design tokens:
|
426
|
-
|
427
|
-
- Color: `siteVariables.red`
|
428
|
-
|
429
|
-
```
|
430
|
-
import { makeStyles, Text } from '@fluentui/react-components';
|
431
|
-
|
432
|
-
const useStyles = makeStyles(theme => ({
|
433
|
-
root: {
|
434
|
-
color: 'rgb(255, 0, 0)'
|
435
|
-
},
|
436
|
-
})
|
437
|
-
|
438
|
-
const MyComponent = () => {
|
439
|
-
const styles = useStyles()
|
440
|
-
|
441
|
-
return <Text className={styles.root}>{...}</Text>
|
442
|
-
}
|
443
|
-
```
|
444
|
-
|
445
|
-
### important [DEPRECATED]
|
446
|
-
|
447
|
-
This property was deprecated. Given that this property depends on the applied style, you can find below examples on how to achieve the same results in the default, dark and high contrast themes:
|
448
|
-
|
449
|
-
#### **teamsTheme**
|
450
|
-
|
451
|
-
Northstar design tokens:
|
452
|
-
|
453
|
-
- Color: `siteVariables.colors.red[400]`
|
454
|
-
- Font weight: `siteVariables.fontWeightBold`
|
455
|
-
|
456
|
-
```
|
457
|
-
import { makeStyles, Text } from '@fluentui/react-components';
|
458
|
-
|
459
|
-
const useStyles = makeStyles(theme => ({
|
460
|
-
root: {
|
461
|
-
color: 'rgb(196, 49, 75)',
|
462
|
-
fontWeight: 700
|
463
|
-
},
|
464
|
-
})
|
465
|
-
|
466
|
-
const MyComponent = () => {
|
467
|
-
const styles = useStyles()
|
468
|
-
|
469
|
-
return <Text className={styles.root}>{...}</Text>
|
470
|
-
}
|
471
|
-
```
|
472
|
-
|
473
|
-
#### **teamsDarkTheme**
|
474
|
-
|
475
|
-
Northstar design tokens:
|
476
|
-
|
477
|
-
- Color: `siteVariables.colors.red[300]`
|
478
|
-
- Font weight: `siteVariables.fontWeightBold`
|
479
|
-
|
480
|
-
```
|
481
|
-
import { makeStyles, Text } from '@fluentui/react-components';
|
482
|
-
|
483
|
-
const useStyles = makeStyles(theme => ({
|
484
|
-
root: {
|
485
|
-
color: 'rgb(231, 53, 80)',
|
486
|
-
fontWeight: 700
|
487
|
-
},
|
488
|
-
})
|
489
|
-
|
490
|
-
const MyComponent = () => {
|
491
|
-
const styles = useStyles()
|
492
|
-
|
493
|
-
return <Text className={styles.root}>{...}</Text>
|
494
|
-
}
|
495
|
-
```
|
496
|
-
|
497
|
-
#### **teamsHighContrastTheme**
|
498
|
-
|
499
|
-
Northstar design tokens:
|
500
|
-
|
501
|
-
- Color: `siteVariables.red`
|
502
|
-
- Font weight: `siteVariables.fontWeightBold`
|
503
|
-
|
504
|
-
```
|
505
|
-
import { makeStyles, Text } from '@fluentui/react-components';
|
506
|
-
|
507
|
-
const useStyles = makeStyles(theme => ({
|
508
|
-
root: {
|
509
|
-
color: 'rgb(255, 0, 0)',
|
510
|
-
fontWeight: 700
|
511
|
-
},
|
512
|
-
})
|
513
|
-
|
514
|
-
const MyComponent = () => {
|
515
|
-
const styles = useStyles()
|
516
|
-
|
517
|
-
return <Text className={styles.root}>{...}</Text>
|
518
|
-
}
|
519
|
-
```
|
520
|
-
|
521
|
-
### success [DEPRECATED]
|
522
|
-
|
523
|
-
This property was deprecated. Given that this property depends on the applied style, you can find below examples on how to achieve the same results in the default, dark and high contrast themes:
|
524
|
-
|
525
|
-
#### **teamsTheme**
|
526
|
-
|
527
|
-
Northstar design tokens:
|
528
|
-
|
529
|
-
- Color: `siteVariables.colors.green[600]`
|
530
|
-
|
531
|
-
```
|
532
|
-
import { makeStyles, Text } from '@fluentui/react-components';
|
533
|
-
|
534
|
-
const useStyles = makeStyles(theme => ({
|
535
|
-
root: {
|
536
|
-
color: 'rgb(35, 123, 75)'
|
537
|
-
},
|
538
|
-
})
|
539
|
-
|
540
|
-
const MyComponent = () => {
|
541
|
-
const styles = useStyles()
|
542
|
-
|
543
|
-
return <Text className={styles.root}>{...}</Text>
|
544
|
-
}
|
545
|
-
```
|
546
|
-
|
547
|
-
#### **teamsDarkTheme**
|
548
|
-
|
549
|
-
Northstar design tokens:
|
550
|
-
|
551
|
-
- Color: `siteVariables.colors.green[200]`
|
552
|
-
|
553
|
-
```
|
554
|
-
import { makeStyles, Text } from '@fluentui/react-components';
|
555
|
-
|
556
|
-
const useStyles = makeStyles(theme => ({
|
557
|
-
root: {
|
558
|
-
color: 'rgb(146, 195, 83)'
|
559
|
-
},
|
560
|
-
})
|
561
|
-
|
562
|
-
const MyComponent = () => {
|
563
|
-
const styles = useStyles()
|
564
|
-
|
565
|
-
return <Text className={styles.root}>{...}</Text>
|
566
|
-
}
|
567
|
-
```
|
568
|
-
|
569
|
-
#### **teamsHighContrastTheme**
|
570
|
-
|
571
|
-
Northstar design tokens:
|
572
|
-
|
573
|
-
- Color: `siteVariables.colors.green[200]`
|
574
|
-
|
575
|
-
```tsx
|
576
|
-
import { makeStyles, Text } from '@fluentui/react-components';
|
577
|
-
|
578
|
-
const useStyles = makeStyles({
|
579
|
-
root: {
|
580
|
-
color: 'rgb(146, 195, 83)',
|
581
|
-
},
|
582
|
-
});
|
583
|
-
|
584
|
-
const MyComponent = () => {
|
585
|
-
const styles = useStyles();
|
586
|
-
|
587
|
-
return <Text className={styles.root}>{/* ... */}</Text>;
|
588
|
-
};
|
589
|
-
```
|
590
|
-
|
591
|
-
### temporary [DEPRECATED]
|
592
|
-
|
593
|
-
This property was deprecated. Given that this property depends on the applied style, you can find below examples on how to achieve the same results in the default, dark and high contrast themes:
|
594
|
-
|
595
|
-
```tsx
|
596
|
-
import { makeStyles, Text } from '@fluentui/react-components';
|
597
|
-
|
598
|
-
const useStyles = makeStyles({
|
599
|
-
root: {
|
600
|
-
fontStyle: 'italic',
|
601
|
-
},
|
602
|
-
});
|
603
|
-
|
604
|
-
const MyComponent = () => {
|
605
|
-
const styles = useStyles();
|
606
|
-
|
607
|
-
return <Text className={styles.root}>{/* ... */}</Text>;
|
608
|
-
};
|
609
|
-
```
|
610
|
-
|
611
|
-
### timestamp [DEPRECATED]
|
612
|
-
|
613
|
-
This property was deprecated. Below is a simple example on how to achieve the same result:
|
614
|
-
|
615
|
-
#### **teamsTheme**
|
616
|
-
|
617
|
-
Northstar design tokens:
|
618
|
-
|
619
|
-
- Color: `siteVariables.colorScheme.default.foreground1`
|
620
|
-
|
621
|
-
```tsx
|
622
|
-
import { makeStyles, Text } from '@fluentui/react-components';
|
623
|
-
|
624
|
-
const useStyles = makeStyles({
|
625
|
-
root: {
|
626
|
-
color: 'rgb(72, 70, 68)',
|
627
|
-
},
|
628
|
-
});
|
629
|
-
|
630
|
-
const MyComponent = () => {
|
631
|
-
const styles = useStyles();
|
632
|
-
|
633
|
-
return <Text className={styles.root}>{/* ... */}</Text>;
|
634
|
-
};
|
635
|
-
```
|
636
|
-
|
637
|
-
#### **teamsDarkTheme**
|
638
|
-
|
639
|
-
Northstar design tokens:
|
640
|
-
|
641
|
-
- Color: `siteVariables.colorScheme.default.foreground1`
|
642
|
-
|
643
|
-
```tsx
|
644
|
-
import { makeStyles, Text } from '@fluentui/react-components';
|
645
|
-
|
646
|
-
const useStyles = makeStyles({
|
647
|
-
root: {
|
648
|
-
color: 'rgb(138, 136, 134)',
|
649
|
-
},
|
650
|
-
});
|
651
|
-
|
652
|
-
const MyComponent = () => {
|
653
|
-
const styles = useStyles();
|
654
|
-
|
655
|
-
return <Text className={styles.root}>{/* ... */}</Text>;
|
656
|
-
};
|
657
|
-
```
|
658
|
-
|
659
|
-
#### **teamsHighContrastTheme**
|
660
|
-
|
661
|
-
Northstar design tokens:
|
662
|
-
|
663
|
-
- Color: `siteVariables.colors.white`
|
664
|
-
|
665
|
-
```tsx
|
666
|
-
import { makeStyles, Text } from '@fluentui/react-components';
|
667
|
-
|
668
|
-
const useStyles = makeStyles({
|
669
|
-
root: {
|
670
|
-
color: 'rgb(255, 255, 255)',
|
671
|
-
},
|
672
|
-
});
|
673
|
-
|
674
|
-
const MyComponent = () => {
|
675
|
-
const styles = useStyles();
|
676
|
-
|
677
|
-
return <Text className={styles.root}>{/* ... */}</Text>;
|
678
|
-
};
|
679
|
-
```
|
680
|
-
|
681
|
-
### variables [DEPRECATED]
|
682
|
-
|
683
|
-
For v9, this feature is no longer supported. The alternative is to apply styles through `makeStyles()` (see [Griffel](https://github.com/microsoft/griffel) docs for more details). Below is an example of a migration:
|
684
|
-
|
685
|
-
#### v0 (Northstar) implementation
|
686
|
-
|
687
|
-
```
|
688
|
-
const MyComponent = () => {
|
689
|
-
return <Text disabled variables={{ disabledColor: 'red' }} />
|
690
|
-
}
|
691
|
-
```
|
692
|
-
|
693
|
-
#### v9 (Fluent UI) implementation
|
694
|
-
|
695
|
-
```tsx
|
696
|
-
import { makeStyles, Text } from '@fluentui/react-components';
|
697
|
-
|
698
|
-
const useStyles = makeStyles({
|
699
|
-
red: {
|
700
|
-
color: 'red',
|
701
|
-
},
|
702
|
-
});
|
703
|
-
|
704
|
-
const MyComponent = () => {
|
705
|
-
const styles = useStyles();
|
706
|
-
|
707
|
-
return <Text className={styles.root}>{/* ... */}</Text>;
|
708
|
-
};
|
709
|
-
```
|
710
|
-
|
711
|
-
### weight
|
712
|
-
|
713
|
-
The name and the usage of the `weight` property remains the same. However, the allowed values have changed:
|
714
|
-
|
715
|
-
| Northstar | Computated value | Fluent UI |
|
716
|
-
| ----------- | ---------------- | ---------- |
|
717
|
-
| `light` | 200 | - |
|
718
|
-
| `semilight` | 300 | - |
|
719
|
-
| `regular` | 400 | `regular` |
|
720
|
-
| - | 500 | `medium` |
|
721
|
-
| `semibold` | 600 | `semibold` |
|
722
|
-
| `bold` | 700 | - |
|
723
|
-
|
724
|
-
### className
|
725
|
-
|
726
|
-
_This property suffered no changes and can be left as is._
|
727
|
-
|
728
|
-
### styles
|
729
|
-
|
730
|
-
_This property suffered no changes and can be used as is. However, we highly recommend that you migrate to `makeStyles()` (a [Griffel](https://github.com/microsoft/griffel) styling solution) for performance reasons._
|