# @askrjs/monaco/monaco-editor

> Published API exports for @askrjs/monaco/monaco-editor.

Source: [https://askrjs.com/docs/reference/api/monaco/monaco-editor](https://askrjs.com/docs/reference/api/monaco/monaco-editor)

Status: stable. Packages: @askrjs/monaco/monaco-editor.

**Published packages are authoritative.** Examples may lag behind a published contract. When guidance differs, verify the exports and TypeScript declarations in your installed package, then file an issue.

## Exports

This entrypoint publishes 11 exports from the declarations shipped by @askrjs/monaco.

### `MonacoBeforeMount`

```ts
MonacoBeforeMount: ((monaco: MonacoNamespace) => void | PromiseLike<void>) | undefined
```

Hook run after Monaco loads but before the editor instance is created.

### `MonacoEditor`

```ts
MonacoEditor: (props: MonacoEditorProps) => JSX.Element
```

Monaco wrapper that keeps the Askr surface thin and forwards real Monaco
models, options, and lifecycle access instead of recreating Monaco's API.

### `MonacoEditorInstance`

```ts
MonacoEditorInstance: Monaco.editor.IStandaloneCodeEditor
```

A live Monaco standalone code editor instance.

### `MonacoEditorOptions`

```ts
MonacoEditorOptions: Omit<Monaco.editor.IStandaloneEditorConstructionOptions, 'model' | 'value' | 'language' | 'theme'>
```

Monaco standalone editor construction options, excluding the fields that
`MonacoEditorProps` manages directly (`model`, `value`, `language`, `theme`).

### `MonacoEditorProps`

```ts
MonacoEditorProps: Omit<JSX.IntrinsicElements['div'], 'children' | 'ref'> & {
  ref?: Ref<HTMLDivElement>;
  children?: never;
  role?: JSX.IntrinsicElements['div']['role'];
  options?: MonacoEditorOptions;
  overrideServices?: Monaco.editor.IEditorOverrideServices;
  model?: MonacoTextModel | null;
  value?: string;
  defaultValue?: string;
  language?: string;
  path?: string | MonacoUri;
  /** Monaco theme name. Monaco applies themes process-wide, so simultaneous editors cannot use different themes. */
  theme?: string;
  monaco?: MonacoNamespace;
  loadMonaco?: MonacoLoader;
  beforeMount?: MonacoBeforeMount;
  onMount?: MonacoMountHandler;
  onUnmount?: MonacoMountHandler;
  onError?: MonacoErrorHandler;
  editorRef?: Ref<MonacoEditorInstance>;
  monacoRef?: Ref<MonacoNamespace>;
}
```

Thin Askr host for Monaco's standalone editor.

Pass raw Monaco `options` and, when needed, provide an external `model`
to keep full access to Monaco's language services, providers, and editor APIs.

- `beforeMount`: beforeMount?: MonacoBeforeMount;

- `children`: children?: undefined;

- `defaultValue`: defaultValue?: string | undefined;

- `editorRef`: editorRef?: Ref<Monaco.editor.IStandaloneCodeEditor>;

- `language`: language?: string | undefined;

- `loadMonaco`: loadMonaco?: MonacoLoader;

- `model`: model?: Monaco.editor.ITextModel | null | undefined;

- `monaco`: monaco?: typeof import("monaco-editor/editor/editor.api") | undefined;

- `monacoRef`: monacoRef?: Ref<typeof import("monaco-editor/editor/editor.api")>;

- `onError`: onError?: MonacoErrorHandler;

- `onMount`: onMount?: MonacoMountHandler;

- `onUnmount`: onUnmount?: MonacoMountHandler;

- `options`: options?: MonacoEditorOptions | undefined;

- `overrideServices`: overrideServices?: Monaco.editor.IEditorOverrideServices | undefined;

- `path`: path?: string | Monaco.Uri | undefined;

- `ref`: ref?: Ref<HTMLDivElement>;

- `role`: role?: ReactiveProp<IntrinsicTextValue>;

- `theme`: Monaco theme name. Monaco applies themes process-wide, so simultaneous editors cannot use different themes.

- `value`: value?: string | undefined;

### `MonacoErrorHandler`

```ts
MonacoErrorHandler: ((error: unknown) => void) | undefined
```

Handler invoked when loading Monaco or applying an edit fails.

### `MonacoLoader`

```ts
MonacoLoader: (() => MonacoNamespace | PromiseLike<MonacoNamespace>) | undefined
```

Loader invoked to resolve the Monaco namespace when `monaco` isn't provided directly.

### `MonacoMountHandler`

```ts
MonacoMountHandler: ((editor: MonacoEditorInstance, monaco: MonacoNamespace) => void) | undefined
```

Handler invoked with the editor and Monaco namespace on mount or unmount.

### `MonacoNamespace`

```ts
MonacoNamespace: typeof import('monaco-editor/editor/editor.api')
```

The `monaco-editor` module namespace, either provided directly or resolved by `loadMonaco`.

### `MonacoTextModel`

```ts
MonacoTextModel: Monaco.editor.ITextModel
```

A Monaco text model backing an editor instance.

### `MonacoUri`

```ts
MonacoUri: Monaco.Uri
```

A Monaco URI, used to identify a text model's path.

## Documentation navigation

[Previous](https://askrjs.com/docs/reference/api/monaco/root/index.md) | [Next](https://askrjs.com/docs/reference/api/monaco/testing/index.md)
