# CodeWrapper React A modular, framework-agnostic library for building interactive code editors and terminals in the browser. Built on top of [CodeMirror](https://codemirror.net/) for code editing and [xterm.js](https://xtermjs.org/) for terminal emulation, with optional [WebContainers](https://webcontainers.io/) integration for in-browser code execution. ## Installation ```shell pnpm add @codewrapper/react @codemirror/state @codemirror/view @xterm/xterm react ``` ## Usage ### Basic Code Editor ```tsx import { CodeEditor, useCodeEditorState } from "@codewrapper/react"; import { EditorView } from "@codemirror/view"; import { StateEffect } from "@codemirror/state"; import { basicSetup } from "codemirror"; function App() { const [value, setValue, stateRef] = useCodeEditorState("
Hello
"); function codeEditorRef(editor: EditorView) { stateRef(editor); const transaction = editor.state.update({ effects: StateEffect.appendConfig.of([basicSetup]), }); editor.dispatch(transaction); } return ( <>
{value}