Variables & Themes
Define, import, and manage design tokens for color, typography, and spacing, kept in sync with code.
On this page
Variables (also known as Tokens or CSS Variables) are named values for things like colors, spacing, typography, and much more. You can use them in Wonder to keep your codebase and Wonder file in sync. You can either import variables directly from your codebase or create new variables in Wonder via chat or manually. You can manage variables in the Variables sidebar panel.
Token types
Currently we support the following types of variables:
- colors
- spacing
- gap
- radius
- width & height
- opacity
- typography
- font family
- font size
- font weight
- letter spacing
- line height
We're working hard to add support for more properties and additional features such as grouped variables (e.g. classes) for typography and shadows.
Add / Create variables in Wonder
To use variables in Wonder, you can either import them from your codebase, ask Wonder AI to create them for you, or create them manually by hand.
From your codebase
- Connect your Wonder file to your codebase via the GitHub integration
- Ask Wonder AI to import the variables from your codebase
- Enable the variables panel in the sidebar
Ask Wonder to generate variables
- Open the chat panel
- Ask Wonder AI to generate variables based on your context
- Enable the variables panel in the sidebar
Create manually
- Open the variables panel in the sidebar
- Click on the little "+" in the top right corner
- Select your variable type
- Give it the correct name
- Change the value
- Optional: with a right-click on the value, you can reference another variable.
Variable naming
You can organize variables in folders by changing the name to neutral/500. This will create a neutral folder and nest the 500 variable inside it. The raw value of that variable when exported will stay neutral-500. So it is just a visual organizing tool for you and your team.
Use a variable
You can assign variables to the supported properties via the visual reference for variables . By clicking this icon, a dropdown will appear which lets you search for your desired variable.
When attached, the property's input field visually shows you that a variable is attached.
To detach a variable, click the little detach icon which appears when hovering over a field with an attached variable .
You can also ask Wonder AI or your agent of choice via MCP to apply tokens to a design, just ask for it in the chat or terminal.
When a repo is connected, variable values track the source: edit them in code or on the canvas and both stay aligned. When you update something, you can also open a PR to update the variables in the codebase. To learn more, see create a pull request.