Skip to content

djgrant/react-code-input

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

68 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

react-code-input

A lightweight component that turns <input type="text" /> into a mini code editor.

Provides basic tokenisation, parsing, syntax highlighting, validation and code completion for simple code expressions.

There are zero dependencies and you can style the input in any way that you want.

View examples →

Quick start

import { CodeInput } from "@djgrant/react-code-input";

export default () => (
  <CodeInput
    placeholder="price - vat"
    symbols={["price", "vat"]}
    customInputComponent={MyInput}
    style={{ width: "300px" }}
    onChange={event => {
      console.log(event.tokens);
      console.log(event.currentTarget.value);
    }}
  />
);

About

Turn <input /> into a mini code editor

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published