Schema-Aware Monaco Editor for React
Drop-in React component that turns any JSON Schema into a guided editing experience. Ghost text, enum dropdowns, property completion, and real-time diagnostics — for JSON, YAML, and JavaScript documents.
Use it in your React app in minutes
import { useState } from "react"; import { SchemaEditor } from "@powerduck/schema-editor/react"; function App() { const [value, setValue] = useState('{"name": ""}'); return ( <SchemaEditor value={value} onChange={setValue} language="json" theme="dark" /> ); }
What you get as a developer
Drop-in React Component
Import from @powerduck/schema-editor/react. Pass value, onChange, and language. The component handles Monaco loading, theming, and layout.
Ghost Text Completion
Gray inline suggestions predict the next property from your JSON Schema. Press Tab to accept. Works for required fields, known keys, and enum values.
Popup Completion
Intellisense dropdowns show available properties. Filtered by current scope — already-used keys are excluded to prevent duplicates.
Live Diagnostics
Type errors, missing required fields, and invalid enums are underlined instantly. Toggle the status bar via showDiagnostics.
Three Languages
JSON for configs, YAML for OpenAPI docs, and JavaScript for schema authoring. Switch the language prop — the same schema drives all three.
Dark & Light Themes
Pass theme="dark" or theme="light". Matches your app design system via the CSS variable interface.
SchemaEditor Props
All props accepted by the React component.
| Prop | Type | Default | Description |
|---|---|---|---|
value required | string | — | Current editor content (controlled) |
onChange | (value: string) => void | — | Called on every content change |
language required | "json" | "yaml" | "javascript" | — | Content language. Determines parser and completion model. |
schema | JsonSchema | — | JSON Schema driving completion, enum dropdowns, and diagnostics. |
theme | "light" | "dark" | "light" | Editor color theme. |
readOnly | boolean | false | Disable editing. Useful for view-only mode. |
placeholder | string | — | Placeholder text shown when value is empty. |
showDiagnostics | boolean | true | Show the diagnostics status bar at the bottom. |
enableCompletion | boolean | true | Enable popup completion suggestions. |
enableInlineSuggestions | boolean | true | Enable ghost text (inline gray suggestions). |
diagnosticsDebounceMs | number | 250 | Debounce delay in milliseconds before running diagnostics. |
onDiagnostics | (diagnostics: Diagnostic[]) => void | — | Called whenever diagnostics change. Use to show errors outside the editor. |
options | Monaco options | — | Extra Monaco editor options passed through. |
style | CSSProperties | — | Inline styles applied to the root container. |
className | string | — | CSS class applied to the root container. |