React SDK agent theme and icons
Guide agents through provider nesting, theme hashes, component sets, and icon/runtime boundaries.
Start here when an agent needs to restore a playground theme, choose a component set, talk about icon behavior, or explain which runtime boundary owns theme state.
Provider and runtime boundary
Keep these roles separate:
EnadProvideris the root SDK runtime provider.EnadProvider componentSet=\{...\}owns app-wide structural set selection.EnadThemeProviderbelongs insideEnadProviderwhen a subtree needs scoped theme state.- The root provider owns SDK-wide runtime setup such as icon registration and shared client/runtime wiring.
- The theme provider owns scoped token overrides and restored theme hashes.
Use the confirmed public imports only:
import "@enadhq/enad-react-sdk/styles.css";
import { EnadProvider } from "@enadhq/enad-react-sdk";
import { EnadThemeProvider } from "@enadhq/enad-react-sdk/client/theme";When exact icon APIs, icon names, provider options, or theme prop names matter, inspect package reference before writing code.
Theme restoration rules
- Correct nesting is
EnadProvideroutside andEnadThemeProvideraround any scoped themed subtree. - Runtime precedence is explicit
EnadThemeProviderprops, then decoded hash values, then SDK defaults. componentSetis structural. It changes the resolver-backed UI family, not only colors.- Token overrides change CSS-variable state and should stay conceptually separate from
componentSetdecisions. - Use
hash=\{themeHash\}when restoring richer playground state. - Use
EnadProvider componentSet="..."when the app only needs the structural family.
Playground boundary
Use the React SDK guides to choose provider boundaries. Use the playground to validate the live result.
- The playground owns runtime editing, share URLs, and export flows.
- React SDK guides cover route selection, provider guidance, and package-aware wording.
enad-themeCSS output or exported snippets do not replaceEnadThemeProviderfor runtime restoration.- Do not copy sandbox-only helpers or route code into a consumer app.
Icon guidance for agents
Keep icon wiring at the SDK runtime boundary. Use package reference for exact icon registry APIs.
Use this rule:
- Keep icon setup discussion at the
EnadProviderboundary. - Verify exact icon helpers, option names, or override APIs in package reference.
- Keep theme state concerns in
EnadThemeProviderrather than mixing them into icon guesses.
Troubleshooting order
If a restored app does not match the playground or icon behavior looks wrong, check in this order:
@enadhq/enad-react-sdk/styles.cssis imported once.EnadThemeProvider, when used, is nested insideEnadProvider.- The same
hashor app-widecomponentSetused in the playground is being restored. - Explicit props are not overriding the intended hash values.
- Exact icon/runtime APIs were taken from package reference instead of prose memory.