0.6.3 • Published 3 years ago
react-code-editor-editable v0.6.3
React code editor
Functionalities
- 191 languages highlighting with Highlight.js.
- 97 themes/styles.
- Scrollable.
- Tab support.
- Optional line numbers on editor.
Installation
npm i react-code-editor-editable
or
yarn add react-code-editor-editable
Usage
import React, { useState } from 'react'
import { CodeEditorEditable } from 'react-code-editor-editable'
import 'highlight.js/styles/dracula.css';
const App = () => {
const [value, setValue] = useState('<div></div>')
return (
<div className='center'>
<CodeEditorEditable
value={value}
setValue={setValue}
width='50vw'
height='50vh'
language='html'
inlineNumbers
/>
</div>
)
}
export default App
Props
Name | Type | Description | Required |
---|---|---|---|
value | string | String that contains the code written. | ✔️ |
setValue | Dispatch<SetStateAction> | Function to that sets the the value field. | ✔️ |
width | string | Code editor width. | ❌ |
height | string | Code editor height. | ❌ |
padding | string | Code editor padding. | ❌ |
borderRadius | string | Code editor border radius. | ❌ |
language | string | See here highlight.js all languages supported . | ✔️ |
inlineNumbers | boolean | Shows line numbers. | ❌ |
caretColor | string | Changes the caret color. | ❌ |
tabSize | number | Number of spaces added when Tab is pressed. | ❌ |