| 1 |
# @patternfly/react-tokens |
| 2 |
|
| 3 |
## Installation |
| 4 |
|
| 5 |
```bash |
| 6 |
yarn add @patternfly/react-tokens |
| 7 |
``` |
| 8 |
|
| 9 |
or |
| 10 |
|
| 11 |
```bash |
| 12 |
npm install --save @patternfly/react-tokens |
| 13 |
``` |
| 14 |
|
| 15 |
## Usage |
| 16 |
|
| 17 |
All Tokens and their corresponding values can be viewed on the |
| 18 |
[All PatternFly tokens][token-page] page. |
| 19 |
|
| 20 |
#### Import tokens |
| 21 |
|
| 22 |
## Examples |
| 23 |
|
| 24 |
```js |
| 25 |
import t_global_background_color_primary_default from '@patternfly/react-tokens/dist/esm/t_global_background_color_primary_default'; |
| 26 |
``` |
| 27 |
|
| 28 |
#### Each token as three properties |
| 29 |
|
| 30 |
- `name`: The CSS custom property name. |
| 31 |
- `value`: The default value for the custom property. |
| 32 |
- `var`: The property name wrapped in `var()`. |
| 33 |
|
| 34 |
```js |
| 35 |
import t_global_background_color_primary_default from '@patternfly/react-tokens/dist/esm/t_global_background_color_primary_default'; |
| 36 |
|
| 37 |
t_global_background_color_primary_default.name === '--pf-t--global--background--color--primary--default'; // true |
| 38 |
t_global_background_color_primary_default.value === '#fff'; // true |
| 39 |
t_global_background_color_primary_default.var === 'var(--pf-t--global--background--color--primary--default)'; // true |
| 40 |
``` |
| 41 |
|
| 42 |
[token-page]: https://www.patternfly.org/tokens/all-patternfly-tokens |