Part 2 of 7. All parts: part 1. Previous: part 1, what atoms are. Next: part 3, installing Content Kit atoms.
Preliminary post. Written with AI assistance and run locally against the starter. Tested with Content SDK beta build 20261105114751, November 2026. Uxbee has requested Early Access to atoms in SitecoreAI but does not have it yet, so for the moment the Design Studio steps come from Sitecore's documentation and are untested. These posts will be updated once we have access. More in part 1.
What this part does
I build a Badge: a small label such as New or Beta, with a tone. It is a good first atom because it needs a Sitecore text field and a choice from a list, and nothing more. Everything goes in the single file src/atoms/index.tsx, which is the route Sitecore documents. That file comes with the starter and holds an empty catalog. The Content Kit already offers Button, Container, Heading, Image, Number and Paragraph, which part 3 installs, so I chose an atom it does not have.
To see the end result of this part, clone the companion repository and check out its tag:
| 1 | git clone https://github.com/rhockUxbee/sitecoreai-content-sdk-nextjs-app-router-atoms-beta.git |
| 2 | cd sitecoreai-content-sdk-nextjs-app-router-atoms-beta |
| 3 | git checkout part-2-badge |
1. Scaffold the app
The starter comes from one command:
| 1 | npx create-content-sdk-app@beta.atoms |
I picked the App Router starter. For the connection to your environment, Sitecore's docs say to copy .env.remote.example to .env.local and paste in the variables from the Developer settings tab of your environment in the Sitecore Cloud portal. The Early Access program, an environment with Sitecore Stream and a configured rendering host come on top of that, as described in part 1.
2. What the starter contains
Before I added anything, the atoms part of the starter was already in place:
src/atoms/index.tsxhas an empty catalog, withcomponents: {}andactions: {}, and an empty registry, withcomponents: {}.src/Providers.tsxpassesatomsConfigtoSitecoreProvider, with the catalog, the registry, anavigatefunction andcompileCssActionfor runtime CSS.instrumentation-node.tsregisters a Tailwind compiler forsrc/app/globals.css, so class names that only exist in layouts still get styles.sitecore.cli.config.tsputs the catalog into the generated metadata and setsatoms.validation.breakOnErrortofalse.package.jsonruns atoms validation beforedevandbuild, and has anatoms:updatescript for the lock file.- Theming is off:
theming.modeis not set, so it defaults tonone. - Three agent skills about atoms sit under
.agents/skills:content-sdk-atoms-setup,content-sdk-atoms-createandcontent-sdk-atoms-maintain. Part 5 is about those. - There is no
.sitecorefolder yet. It appears after the first run.
3. The first run and the lock file
The lock file is what the tooling compares your catalog against. On a fresh scaffold, validation has nothing to compare with:
| 1 | npm run sitecore-tools:atoms:validate |
| 2 | |
| 3 | [Codegen] Creating Sitecore directory: .sitecore |
| 4 | [IE-008] Lock file validation failed: |
| 5 | - [MV-012] Lock file not found. Run `sitecore-tools project atoms update` to generate it. |
The fix is the update command:
| 1 | npm run sitecore-tools:atoms:update |
| 2 | [atoms update] Lock file updated successfully. |
With an empty catalog, .sitecore/atoms.lock.json is just a timestamp and an empty atoms object. Validation then says atoms.lock.json is up to date. The lock file is meant to be committed. The starter's .gitignore ignores .sitecore/* except this file.
4. The first atom: a Badge
This is all of src/atoms/index.tsx:
| 1 | import { z } from 'zod'; |
| 2 | import { |
| 3 | defineAtomsCatalog, |
| 4 | defineAtomsRegistry, |
| 5 | textFieldSchema, |
| 6 | } from '@sitecore-content-sdk/nextjs/atoms'; |
| 7 | |
| 8 | export const catalog = defineAtomsCatalog({ |
| 9 | stylingSolution: 'tailwind', |
| 10 | components: { |
| 11 | Badge: { |
| 12 | description: |
| 13 | 'A small label for a status or category, such as "New" or "Beta". Use the tone to signal meaning.', |
| 14 | props: z.object({ |
| 15 | text: textFieldSchema(), |
| 16 | tone: z.enum(['neutral', 'info', 'success', 'warning']).default('neutral'), |
| 17 | className: z.string().optional(), |
| 18 | }), |
| 19 | }, |
| 20 | }, |
| 21 | actions: {}, |
| 22 | }); |
| 23 | |
| 24 | const toneClasses = { |
| 25 | neutral: 'bg-neutral-100 text-neutral-800', |
| 26 | info: 'bg-blue-100 text-blue-800', |
| 27 | success: 'bg-green-100 text-green-800', |
| 28 | warning: 'bg-amber-100 text-amber-900', |
| 29 | } as const; |
| 30 | |
| 31 | export const registry = defineAtomsRegistry(catalog, { |
| 32 | components: { |
| 33 | Badge: ({ props }) => { |
| 34 | const classes = [ |
| 35 | 'inline-block rounded-full px-3 py-1 text-sm font-medium', |
| 36 | toneClasses[props.tone ?? 'neutral'], |
| 37 | props.className, |
| 38 | ] |
| 39 | .filter(Boolean) |
| 40 | .join(' '); |
| 41 | |
| 42 | return <span className={classes}>{props.text?.value}</span>; |
| 43 | }, |
| 44 | }, |
| 45 | }); |
Three things are worth pointing out.
- The catalog says what Design Studio may use. The description is not decoration: it is what Design Studio's AI reads to decide when a Badge fits. Write it for that reader.
- The registry says how it renders. The names must match, and TypeScript infers props per component from the catalog, so
props.textandprops.toneare typed. - I set
stylingSolutiontotailwind, because the starter already registers the Tailwind compiler. Without it the catalog defaults toinline-css. The class names intoneClassesare compiled at runtime when they only show up in a layout.
I did not add the Badge to the component map. Atoms are registered through atomsConfig on the provider, and the starter's skills say so explicitly. The code type-checks, and npm run build ran to the end with it.
5. Add the atom to the lock file
Validation compares the catalog with .sitecore/atoms.lock.json. After adding the Badge, the lock file does not know it yet:
| 1 | npm run sitecore-tools:atoms:validate |
| 2 | |
| 3 | [IE-008] Lock file validation failed: |
| 4 | - [MV-014] Atom "Badge" is new and not in the lock file. Run `sitecore-tools project atoms update` to add it. |
My lock file still held an earlier test atom, so I saw MV-013 as well, for the atom that was no longer in the catalog. Running the update command fixes both:
| 1 | npm run sitecore-tools:atoms:update |
| 2 | [atoms update] Lock file updated successfully. |
The lock file now holds one entry, Badge, with a hash of its schema, and validation says it is up to date. Commit the lock file with the catalog.
6. What Design Studio receives
The catalog travels as metadata. Running the build writes .sitecore/metadata.json, and the atoms catalog sits under capabilities.designLibrary.atoms.metadata.catalog. For the Badge it holds:
stylingSolution: tailwindnameand the description I wrotepropsSchemaas JSON Schema, where the field schemas carry hints for Design Studio. The text field hascontrolSingle-Line TextandfieldTypeText.slots: ["default"], although I declared none, andlegacy: false
Two small surprises. Because I used .default('neutral'), tone shows up as required in the JSON Schema. And I set no example, so none is in the output. The SDK types say an example is generated from the Zod schema when you leave it out, but I did not see it in this file. The Content Kit's Button sets its example by hand, so I would do the same for anything important.
7. Break the lock file on purpose
Then I changed things to see which message each change gives. After every scenario I restored the file.
- Add a prop to the Badge:
IV-010, atom "Badge" schema has changed. - Add
version: '1.0.0'to the Badge without updating the lock:IV-009, the lock file has no version, current is "1.0.0". Afteratoms:updatethe lock stores the version beside the hash. Bumping only the version to1.1.0then givesIV-009again. - Remove the Badge from the catalog while the lock still lists it:
MV-013, atom is in the lock file but not found in current definitions.
After each of these, atoms:update followed by a commit is how you accept the change. The hash only covers the schema, so adding a version does not change it. Part 3 shows a related one, IV-008, which appears when you set a version on the whole catalog.
Then the setting that matters for CI. With breakOnError set to true in sitecore.cli.config.ts, the IV-010 case ends with an extra line, IE-009 Atom validation failed, and the command exits with code 1. With the starter's default, false, I saw the same IV-010 only logged: the command exits with code 0, and in the dev pipeline the next step, generating the component map, still runs. Locally you can miss a drift that way, which is why I would set it to true in CI.
8. What the docs say about Design Studio (not tested)
I have not tried this part. Atoms in SitecoreAI are an Early Access feature and I do not have access yet. What follows is what Sitecore's documentation describes, so you know what to expect. It may differ from what you see.
Up to here everything ran on my machine. To see the Badge in Design Studio, the local app has to talk to a SitecoreAI environment.
Connect the app.
- In the Sitecore Cloud portal, open your project, then Open app and Manage environments, and select the environment.
- On the Developer settings tab, under Environment variables, pick your site, confirm the SDK version is Content SDK, and choose the Preview or Live context. Copy the variables.
- Copy
.env.remote.exampleto.env.local, paste the variables, remove duplicates and save. - Run
npm run devand openhttp://localhost:3000. The docs say that if you see the default landing page for your site, the app has connected.
The atoms get-started guide also expects the generated app to replace the rendering app in your XM Cloud starter repository, keeping files like xmcloud.build.json. If your project is set up differently, check that page first.
Connect the local host to Pages. In Pages, open the editing host selector at the top left, choose Local host and enter http://localhost:3000/. Third-party cookies must be allowed. Sitecore's atoms guide says you need this local host connection to use the local app inside Design Studio. The Pages page itself talks about JSS 22.1 and later and does not mention the Content SDK beta, so it is unclear whether it works the same for this app.
The catalog arrives. While the app runs, Design Studio receives the catalog from the app. The Badge should appear in the Atoms section.
Assemble a component. In Design Studio, choose Spaces, then Add component, and open the component in Design mode. Drag an atom from the Atoms section onto the canvas, set its properties in the Selected Atoms panel, and use Layers to see the structure. Registering an atom does not place it on a page by itself: the layout decides where it appears.
Activate it. Click Activate in the top right. The Configure dialog asks for a name, which cannot be changed afterwards, a section, and the sites where the component is available. Then you pick which variants to activate. Draft variants you do not select are deleted.
Two details from the docs to keep in mind. Activation is only available on environments running Content SDK version 2.3. And activated variants cannot be removed from Design Studio afterwards, so test with a throwaway component.
Use it in Page builder. Per the docs, after activation the selected variants are available in Page builder. They do not describe how a component is placed on a page, or whether the Install step has to finish first. On a published page, the SDK loads the layout through a rendering parameter called ComponentRef, and the fieldNames parameter picks the variant.
If the component stays blank. The docs' troubleshooting page points to the same places as the skills: the layout reference is empty or cannot be loaded, atomsConfig is missing, or an atom has no renderer with the same name as its catalog entry. If Design Studio does not see your atoms, check that the catalog reaches atomsConfig and that .sitecore/metadata.json has the catalog. A catalog of {} means the input is missing.
What I do not know. Whether Design Studio picks up a catalog change without restarting the app. Whether the four tones of the Badge render with the right colors there, which depends on the Tailwind compiler.
9. What I ran and created
For the record, in order:
- On the fresh scaffold: validate (
MV-012) and update, as in section 3. Then replacedsrc/atoms/index.tsxwith the Badge code above. npm run sitecore-tools:atoms:validate:MV-014andMV-013.npm run sitecore-tools:atoms:update, then validate: passes.npx tsc --noEmit: clean.- The scenarios in section 7, with temporary edits to
src/atoms/index.tsx,sitecore.cli.config.tsand the lock file, each restored afterwards. npm run build: ran to the end.
What that left in the project: the Badge in src/atoms/index.tsx, and the generated .sitecore folder, where atoms.lock.json and metadata.json are the atoms parts. I did not start the dev server or open the app.
Checklist
- Generate the lock file right after scaffolding, and commit it.
- Write catalog descriptions for the AI that reads them.
- Run validation in CI with
breakOnErrorset totrue. - Keep atoms out of the component map.
Next up, part 3: the Content Kit already has six atoms, so let's install them next to the Badge.






