Skip to content
| Marketplace
Sign in
Visual Studio Code>Other>Sitecore Component ScaffoldNew to Visual Studio Code? Get it now.
Sitecore Component Scaffold

Sitecore Component Scaffold

Yaochang.Liu

|
1 install
| (0) | Free
Generate a Sitecore Headless SXA component — Sitecore items and a starter Next.js component — from a single guided wizard
Installation
Launch VS Code Quick Open (Ctrl+P), paste the following command, and press enter.
Copied to clipboard
More Info

Sitecore Component Generator

Generate a complete Sitecore Headless SXA component — datasource template, JSON Rendering, Rendering Parameters template, placeholder(s), dictionary entries, rendering variants, per-site wiring, and a starter Next.js .tsx component file — from a single guided wizard, without leaving VS Code. Works against SitecoreAI (XM Cloud) and classic XP/XM alike, and against both local (including Docker-based) and cloud-hosted CM instances.

No manual environment setup — and no CLI required either

Environments live in .sitecore/user.json — the same file Sitecore CLI's sitecore login / dotnet sitecore login manages — instead of a form you fill in by hand. There are two ways to get one there:

  • Already use the CLI? Run sitecore login (or dotnet sitecore login) in your Sitecore project as usual; the extension picks up whatever's in user.json, including its cached token.
  • Don't have the CLI installed? Run Sitecore: Add Environment — it asks for a name, environment type, CM host (and an Identity Server authority for classic XP), and writes a new endpoint straight into .sitecore/user.json itself, creating the file if it doesn't exist yet. No CLI install required. It's fully compatible with a real CLI too — both can read/write the same file without conflicting.

Either way:

  1. Set sitecoreComponentGenerator.userConfigPath if your user.json isn't at the default .sitecore/user.json relative to the workspace root.
  2. Run Sitecore: Select Environment to pick which of user.json's named endpoints to generate into (skip this if you just added one — it's made active automatically).
  3. Run Sitecore: Open Component Generator.

If that endpoint already has a valid accessToken/refreshToken from the CLI, you're connected immediately — no sign-in needed. Otherwise the extension runs the same interactive Device Code flow Sitecore's own CLI uses (a browser tab opens automatically; approve the code shown), and caches the result in VS Code's encrypted SecretStorage. Sign-in never writes back to user.json — only Sitecore: Add Environment does, and only to add the new endpoint you asked for.

Status bar

A status bar item (bottom right) always shows the active environment and its connection status — $(pass-filled) connected, $(warning) expired, $(circle-large-outline) signed out, $(circle-slash) nothing configured yet — turning its background yellow whenever it needs attention. Click it for a quick-action menu (open the wizard, switch environment, sign in/out of the active one, add an environment) without going through the Command Palette.

Commands

Command Description
Sitecore: Open Component Generator Opens the wizard.
Sitecore: Add Environment Writes a new endpoint into user.json (creating it if needed) — no Sitecore CLI required.
Sitecore: Select Environment Picks which user.json endpoint to generate into.
Sitecore: Sign In Signs in to a specific endpoint without opening the wizard.
Sitecore: Sign Out Clears a cached sign-in.

Clicking the status bar item offers the same actions (plus "Sign In"/"Sign Out" acting directly on the active environment) as a single QuickPick, without needing the Command Palette.

Settings

Setting Default Description
sitecoreComponentGenerator.userConfigPath .sitecore/user.json Path to your Sitecore CLI user.json (absolute, or relative to the workspace root).
sitecoreComponentGenerator.frontendOutputPath (none) Folder (absolute, or relative to the workspace root) where generated frontend component files are written directly. Each component gets its own kebab-case subfolder (e.g. hero-banner/HeroBanner.tsx). Leave unset to be prompted for a save location instead.

What the wizard generates

Configure once in the Settings tab (Path Groups, Sites, Template Icons), then in the Generator tab:

  1. Template — component name, icon, datasource template fields (with optional sub-item templates for Multilist/Droplink sources).
  2. Rendering, Placeholders & Variants — JSS component name, placeholder(s), rendering variants.
  3. Dictionary — per-component dictionary entries.
  4. Paths, Folders & Sites — which Path Group to use, which sites to make the component available on, and which "Available Renderings" group it gets appended to per site.
  5. Review & Create — a GraphQL preview, a copyable Next.js starter component (Content SDK or classic JSS, Pages or App Router, quote style matched to the target project's own Prettier config), and the actual "Create component" action. Generation is resumable — retrying only re-runs steps that haven't already succeeded. The component file writes straight into sitecoreComponentGenerator.frontendOutputPath if set, or prompts for a save location otherwise.
  • Contact us
  • Jobs
  • Privacy
  • Manage cookies
  • Terms of use
  • Trademarks
© 2026 Microsoft