Restore a theme from the playground
Move a playground theme hash into a React SDK app without confusing runtime theming with generated CSS.
Use this guide when a design has been tuned in the live playground and the app needs to restore that runtime theme state.
The playground is the runtime lab. Enad docs explain the handoff. Exact token names, decoded hash shape, provider props, and component-set internals remain owned by SDK package reference.
The provider model
Keep the two providers separate:
EnadProvideris the root SDK runtime provider.EnadThemeProviderwraps the themed subtree.EnadThemeProviderdoes not replaceEnadProvider.
import { EnadProvider } from "@enadhq/enad-react-sdk";
import { EnadThemeProvider } from "@enadhq/enad-react-sdk/client/theme";
const themeHash = "paste-playground-theme-hash-here";
export function StorefrontShell({ children }: { children: React.ReactNode }) {
return (
<EnadProvider>
<EnadThemeProvider hash={themeHash}>{children}</EnadThemeProvider>
</EnadProvider>
);
}This snippet is a placement pattern. Use the actual hash exported by the playground for the theme you reviewed.
Precedence rules
When multiple theme inputs are present, the runtime resolves them in this order:
- explicit
EnadThemeProviderprops - decoded hash values
- SDK defaults
That means an explicit componentSet prop can intentionally override a component set stored in a playground hash. Explicit token props can also override decoded token values.
Component sets are structural
componentSet is structural, rather than only a color preset. It changes the component family selected by resolver-backed components and component systems. Tokens and generated CSS affect CSS-variable state; component sets affect the UI family shape.
Use a direct component set when that is the only runtime decision. The provider can stay explicit, and the app does not need to carry a playground hash just to choose the structural family.
import { EnadProvider } from "@enadhq/enad-react-sdk";
import { EnadThemeProvider } from "@enadhq/enad-react-sdk/client/theme";
export function EditorialShell({ children }: { children: React.ReactNode }) {
return (
<EnadProvider>
<EnadThemeProvider componentSet="editorial">{children}</EnadThemeProvider>
</EnadProvider>
);
}Use hash=\{themeHash\} instead when the playground export carries richer state than a single structural component-set choice.
Where the CLI fits
The enad-theme CLI generates CSS. It does not replace EnadThemeProvider when the app needs runtime hash restoration, scoped token overrides, or component-set state.
A safe mental model:
- CLI output: CSS assets and token output
EnadThemeProvider: runtime restoration and scoped theme stateEnadProvider: root SDK runtime
Verification path
After adding the theme:
- Confirm the SDK stylesheet is imported once.
- Confirm
EnadProvideris outsideEnadThemeProvider. - Confirm the same playground hash is passed to
EnadThemeProvider. - Remove explicit
componentSetor token props if they should not override the hash. - Compare against the live playground using the same component and theme state.