import { Meta } from '@storybook/addon-docs/blocks';

<Meta title="Utilities/getTokenVar" />

# getTokenVar(token)

This utility allows you to retrieve a token's CSS variable as a string, eg. `var(--abc123)`;

```ts
import { color } from '@preply/ds-core';
import { getTokenVar } from '@preply/ds-web-core';

const myStyle = getTokenVar(color.background.primary);
```

Note that the actual value depends on the parent `ThemeProvider`.

Use the [Token Explorer](/story/guides-token-explorer--page) to search tokens by name, id, or value
(make sure you have the correct theme selected).
