react-codemirror-ts
TypeScript icon, indicating that this package has built-in type declarations

0.0.3 • Public • Published

react-codemirror-ts

npm deps licenses downloads size

Codemirror react wrapper made with typescript

Installation

npm i react-codemirror-ts

Usage

import { Codemirror } from 'react-codemirror-ts';
import React, { useState } from 'react';

import 'codemirror/mode/javascript/javascript';
import 'codemirror/addon/edit/matchbrackets';
import 'codemirror/lib/codemirror.css';

function CodemirrorExample() {
  const [value, setValue] = useState<string>('');
  return (
    <Codemirror
      defaultValue=""
      value=""
      name="example"
      path="example"
      options={{
        lineNumbers: true,
        lineWrapping: true,
        matchBrackets: true,
        mode: 'javascript',
        tabSize: 2,
      }}
      onChange={(value, options) => {
        setValue(value);
      }}
    />
  );
}

export { CodemirrorExample };

License

Refer to LICENSE file

Package Sidebar

Install

npm i react-codemirror-ts

Weekly Downloads

2

Version

0.0.3

License

MIT

Unpacked Size

9.97 kB

Total Files

5

Last publish

Collaborators

  • atassis