Note: Studio is currently part of an Early Access Program and may not be available to all users. Contact the Contentstack support team; they will coordinate with the appropriate stakeholders to review eligibility.
Studio is a low-code platform that allows developers and designers to build modern websites using Contentstack-managed content and reusable design components. While the UI provides drag-and-drop composition, the CLI supports tasks such as sync and register components and importing design tokens, ensuring those reusable components are available in code-based workflows.
This step-by-step guide explains how to integrate Figma designs into Studio using the CLI.
The following steps provide an overview of the CLI workflow for importing Figma designs into Studio.
The workflow uses the following CLI commands to import Figma designs into Studio.:
To work with Studio using the CLI, install the Contentstack CLI and then add the Studio plugin.
Run the following commands in your terminal:
$ npm i -g @contentstack/cli
After installing the Contentstack CLI, install the Studio plugin:
$ csdx plugins:install @contentstack/studioOnce the installation is complete, you can start using Studio-specific CLI commands to manage Studio projects and workflows.
The set:region command configures your CLI session to a specific Contentstack region.
This ensures that all authentication, API calls, and Studio plugin interactions are directed to the correct environment (for example, North America, Europe, or Asia-Pacific).
Note: Region selection is a default Contentstack CLI behavior and must be completed before you log in.
csdx config:set:regionThe login command authenticates your CLI session, allowing secure access to stacks, projects, and components in Studio.
csdx login --oauth
Note: If the browser does not open automatically, a URL will be generated in the terminal. Copy and paste the URL into your browser.
The project command links your CLI session to a specific Studio project, ensuring that all component and design token actions are executed in the correct project environment.
csdx studio:project:setcsdx studio:project:set --project-id=<project-id>Once the project is set, you can start using component and design token commands in your CLI session.
Additional Resource: To get the project ID of your project, refer to the Create a Project document.
The sync command makes your existing local code components in your Studio project available to the Figma plugin for mapping.
To sync your existing code components with the Figma plugin, run the following command in your terminal:
csdx studio:component:sync --component-path=<path-to-file>Once executed, the CLI registers and maps the specified component internally. The component appears in the plugin’s mapping dropdown, allowing designers to link Figma layers to corresponding code components.
Additional Resource:To map components using the Figma plugin, refer to the Work with the Studio Figma Plugin documentation.
Options
Example: To sync the HeroBanner.tsx component:
csdx studio:component:sync --component-path=./components/HeroBanner.tsx;The add command integrates components from Figma into your local project. It supports two subcommands:
To add a Figma component to your Studio project, perform the following steps:
csdx studio:component:add --component-id=<component-id>Tip: You can run this command without keeping Studio open.
Tip: To override the detected styling method, include your preference in the prompt. Example: “Use CSS Modules instead of Tailwind.”
The generated files are saved directly to your local project directory. Register and reuse the components in Studio or use the code independently.
The design-token:add command retrieves and registers all design elements such as colors, typography, and effects associated with a specific Figma component.
To add the design tokens to your project, perform the following steps:
csdx studio:design-token:add --design-token-id=<design-token-id>Additional Resource: To learn how to retrieve the design token ID, refer to the Work with Studio Figma Plugin documentation.
Once registered, the design tokens appear in the Design tab of Studio for visual editing.
Tip: To update existing design tokens, run the same command again. The CLI auto-refreshes any previously registered tokens.
The register command adds your custom local UI components to Studio, making them available for reuse in the visual editor.
You can register either a single component file or all components in a directory, depending on your use case.
Run the following command to register a specific component:
csdx studio:component:register --component-path=<path-to-file>Example:
csdx studio:component:register --component-path=./src/components/Navbar.tsxRun the following command to register multiple components at once:
csdx studio:component:register --component-dir=<path-to-directory>Example:
csdx studio:component:register --component-dir=./src/components/Once executed, the CLI scans the provided file or folder for valid component declarations (e.g., export default, type, or interface) and registers them with Studio.
After registration, the components appear in Studio’s visual editor for drag-and-drop reuse.