How insertion works
When you click a token in the sidebar, Design Tokens Explorer inserts it at the cursor position in the active editor. The inserted text is automatically formatted based on the language of the file and the context around the cursor. If no editor is active, the formatted value is copied to the clipboard instead.Language-aware formatting
The extension detects the active file’s language ID and formats the token accordingly:| Context | Inserted value | Example |
|---|---|---|
| CSS, SCSS, Less | var(--token-name) | var(--color-primary) |
| CSS-in-JS (JSX, TSX, Vue, Svelte, Astro) | var(--token-name) | var(--color-primary) |
| JavaScript, TypeScript | 'token-name' | 'color-primary' |
| JSON / JSONC | "token-name" | "color-primary" |
| Other | raw token name | color-primary |
Cursor context detection
The formatter also inspects the characters around the cursor to avoid double-quoting:- If the cursor is already inside a string in JS/TS, the token name is inserted as a raw value (no quotes added).
- If the cursor is already inside a
var(expression in CSS, only the token name with--is inserted.
Custom CSS insert format
The default CSS insertion format isvar(--{name}). You can override this with the cssInsertFormat setting:
settings.json
{name} as the placeholder. The format applies to all CSS-family languages and CSS-in-JS contexts.
Examples for custom setups:
Click behavior
By default, clicking a token inserts it at the cursor. You can change this to always copy instead:settings.json
tokenClickAction setting. This lets you grab a token value without disturbing the cursor position.
Command palette
You can also invoke insertion via the Command Palette:- Design Tokens: Search (
Ctrl+Shift+P→Design Tokens: Search) — opens a QuickPick search over all loaded tokens. Selecting an entry inserts or copies it using the same formatting logic.
Inserting in different file types
CSS / SCSS / Less
In stylesheet files, tokens are inserted asvar(--token-name) (or your custom format):
JavaScript / TypeScript
In script files, tokens are inserted as quoted strings:JSX / TSX inline styles
CSS-in-JS contexts (JSX/TSX with inlinestyle props, Vue <style>, Svelte <style>, Astro <style>) are treated as CSS and receive var(--token-name):