Package Exports
- @object-ui/react
- @object-ui/react/dist/index.js
This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (@object-ui/react) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.
Readme
@object-ui/react
React bindings and SchemaRenderer component for Object UI.
Features
- ⚛️ SchemaRenderer - Main component for rendering Object UI schemas
- 🪝 React Hooks - Hooks for accessing renderer context
- 🔄 Context Providers - React Context for state management
- 📦 Tree-Shakable - Import only what you need
Installation
npm install @object-ui/react @object-ui/corePeer Dependencies:
react^18.0.0 || ^19.0.0react-dom^18.0.0 || ^19.0.0
Usage
Basic Example
import { SchemaRenderer } from '@object-ui/react'
const schema = {
type: 'text',
value: 'Hello, Object UI!'
}
function App() {
return <SchemaRenderer schema={schema} />
}With Data
import { SchemaRenderer } from '@object-ui/react'
const schema = {
type: 'form',
body: [
{
type: 'input',
name: 'name',
label: 'Name',
value: '${user.name}'
}
]
}
const data = {
user: { name: 'John Doe' }
}
function App() {
return <SchemaRenderer schema={schema} data={data} />
}Handling Actions
import { SchemaRenderer } from '@object-ui/react'
function App() {
const handleSubmit = (data) => {
console.log('Form submitted:', data)
}
return (
<SchemaRenderer
schema={formSchema}
onSubmit={handleSubmit}
/>
)
}Hooks
useSchemaContext
Access the current schema context:
import { useSchemaContext } from '@object-ui/react'
function MyComponent() {
const { data, updateData } = useSchemaContext()
return <div>{data.value}</div>
}useRegistry
Access the component registry:
import { useRegistry } from '@object-ui/react'
function MyComponent() {
const registry = useRegistry()
const Component = registry.get('button')
return <Component {...props} />
}API Reference
See full documentation for detailed API reference.
License
MIT