GenerativeUIView renders a JSON UI spec in React Native. The default node renderer (GenUINode) receives style validators from the view; you can override styles or supply a custom renderer.
For a full usage example, see this file.
| Prop | Type | Description |
|---|---|---|
spec | { root, elements } or null / undefined | The UI spec to render |
loading | boolean | Optional; shows loading placeholder when truthy and spec is empty |
showCollapsibleJSON | boolean | Optional; shows an expandable JSON debug panel |
styles | object | Optional; merged with default GEN_UI_STYLES and passed to GenUINode |
GenUINodeComponent | component | Optional; custom component to render the tree; receives { nodeId, elements, styles }; delegate to default GenUINode for nodes you don’t handle |
The default GenUINode does not import GEN_UI_STYLES itself. GenerativeUIView merges the registry default with any styles prop and passes the result down as the styles prop to GenUINode. All style validation is driven by what the view provides, so you can pass custom validators:
You can supply your own node renderer and reuse the library’s style/prop parsing via parseGenUIElementProps. For one type render a custom component; for everything else use the default GenUINode. Pass GenUINodeComponent through so custom types work at any depth.
Example: custom Badge type, default renderer for the rest.
parseGenUIElementProps(element, styleValidators, options?) returns { baseStyle, text, label, props } and runs the same validation and prop parsing as the default renderer. Use it for custom node types that should respect the same style schema.