# @types/react-codemirror

> TypeScript definitions for react-codemirror

Latest version **1.0.11** (published 2023-11-07) · MIT license · 0 weekly downloads

## Install

```sh
npm install @types/react-codemirror
pnpm add @types/react-codemirror
yarn add @types/react-codemirror
bun add @types/react-codemirror
```

## Health

**Score 45/100 (D)** — status: abandoned.

Positive: has types; no vulnerabilities; high maintenance score; popular repo; extremely popular.

Warnings: low downloads; no esm support.

Negative: abandoned.

## Facts

| | |
|---|---|
| Version | 1.0.11 |
| Published | 2023-11-07 |
| First published | 2016-08-02 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | bundled |
| Module format | CommonJS |
| Dependencies | 2 |
| Unpacked size | 7.1 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 51443 |
| Maintainers | types |

## Links

- npm: https://www.npmjs.com/package/@types/react-codemirror
- Repository: https://github.com/DefinitelyTyped/DefinitelyTyped
- Homepage: https://github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/react-codemirror
- npm.io page: https://npm.io/package/@types/react-codemirror

## Dependencies (2)

- [@types/react](https://npm.io/package/@types/react.md) *
- [@types/codemirror](https://npm.io/package/@types/codemirror.md) *

## Recent versions

- 1.0.11 (latest) — 2023-11-07
- 1.0.7 (ts3.9) — 2022-03-12
- 1.0.6 (ts3.8) — 2021-10-21
- 1.0.3 (ts3.2) — 2019-11-26
- 1.0.2 (ts2.8) — 2018-08-04
- 1.0.1 (ts2.6) — 2018-02-12
- 1.0.0 (ts2.4) — 2017-08-09
- 0.2.7 (ts2.3) — 2017-06-23
- 0.2.6 (ts2.1) — 2017-01-23
- 0.2.5 (ts2.0) — 2016-11-21
- 1.0.10 — 2023-10-18
- 1.0.9 — 2023-09-27
- 1.0.8 — 2023-01-23
- 1.0.5 — 2021-07-08
- 1.0.4 — 2021-05-05
- … 4 more at https://npm.io/package/@types/react-codemirror/versions

## README

# Installation
> `npm install --save @types/react-codemirror`

# Summary
This package contains type definitions for react-codemirror (https://github.com/JedWatson/react-codemirror).

# Details
Files were exported from https://github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/react-codemirror.
## [index.d.ts](https://github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/react-codemirror/index.d.ts)
````ts
/// <reference types="react"/>
/// <reference types="codemirror"/>

declare namespace ReactCodeMirror {
    interface ReactCodeMirrorProps {
        children?: React.ReactNode;
        /** Automatically focuses the editor when it is mounted (default false) */
        autoFocus?: boolean | undefined;
        /** Automatically persist changes to underlying textarea (default false) */
        autoSave?: boolean | undefined;
        /** Adds a custom CSS class to the editor */
        className?: string | undefined;
        /** Provides a specific CodeMirror instance (defaults to `require('codemirror')`) */
        codeMirrorInstance?: ((host: any, options?: CodeMirror.EditorConfiguration) => CodeMirror.Editor) | undefined;
        /** Provides the default (not changed tracked) value to the editor */
        defaultValue?: string | undefined;
        /** Set the name of the editor input field */
        name?: string | undefined;
        /** Called when a change is made */
        onChange?: ((newValue: string, change: CodeMirror.EditorChange) => any) | undefined;
        /** Called when the cursor is moved */
        onCursorActivity?: ((codemirror: CodeMirror.Editor) => any) | undefined;
        /** Called when the editor is focused or loses focus */
        onFocusChange?: ((focused: boolean) => any) | undefined;
        /** Called when the editor is scrolled */
        onScroll?: ((scrollInfo: CodeMirror.ScrollInfo) => any) | undefined;
        /** Options passed to the CodeMirror instance */
        options?: CodeMirror.EditorConfiguration | undefined;
        /** (DEPRECATED), use `name` */
        path?: string | undefined;
        /** Preserve previous scroll position after updating value */
        preserveScrollPosition?: boolean | undefined;
        /** The editor value */
        value?: string | undefined;
    }
}

declare module "react-codemirror" {
    class RCM extends React.Component<ReactCodeMirror.ReactCodeMirrorProps> {
        /** Focuses the CodeMirror instance. */
        focus(): void;

        /** Returns the CodeMirror instance, if available. */
        getCodeMirror(): CodeMirror.Editor;
    }
    export = RCM;
}

````

### Additional Details
 * Last updated: Tue, 07 Nov 2023 09:09:39 GMT
 * Dependencies: [@types/codemirror](https://npmjs.com/package/@types/codemirror), [@types/react](https://npmjs.com/package/@types/react)

# Credits
These definitions were written by [Vicky Lai](https://github.com/velveret), and [Rudi Chen](https://github.com/rudi-c).

---
_Source: https://npm.io/package/@types/react-codemirror · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
