Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

react-simple-code-editor

Package Overview
Dependencies
Maintainers
1
Versions
43
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

react-simple-code-editor

Simple no-frills code editor with syntax highlighting

  • 0.10.0
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
93K
decreased by-62.77%
Maintainers
1
Weekly downloads
 
Created

What is react-simple-code-editor?

react-simple-code-editor is a lightweight code editor component for React applications. It provides a simple and customizable way to integrate a code editor into your React projects, supporting syntax highlighting and other basic code editing functionalities.

What are react-simple-code-editor's main functionalities?

Basic Code Editing

This feature allows you to create a basic code editor with syntax highlighting for JavaScript. The code sample demonstrates how to set up the editor, handle code changes, and apply syntax highlighting using Prism.js.

import React, { useState } from 'react';
import Editor from 'react-simple-code-editor';
import { highlight, languages } from 'prismjs/components/prism-core';
import 'prismjs/components/prism-clike';
import 'prismjs/components/prism-javascript';

const CodeEditor = () => {
  const [code, setCode] = useState('// Write your code here');

  return (
    <Editor
      value={code}
      onValueChange={code => setCode(code)}
      highlight={code => highlight(code, languages.js)}
      padding={10}
      style={{
        fontFamily: 'monospace',
        fontSize: 12,
      }}
    />
  );
};

export default CodeEditor;

Custom Styling

This feature demonstrates how to apply custom styling to the code editor. The code sample shows how to change the font size, background color, border, and padding to create a more customized appearance.

import React, { useState } from 'react';
import Editor from 'react-simple-code-editor';
import { highlight, languages } from 'prismjs/components/prism-core';
import 'prismjs/components/prism-clike';
import 'prismjs/components/prism-javascript';

const CustomStyledEditor = () => {
  const [code, setCode] = useState('// Write your code here');

  return (
    <Editor
      value={code}
      onValueChange={code => setCode(code)}
      highlight={code => highlight(code, languages.js)}
      padding={10}
      style={{
        fontFamily: 'monospace',
        fontSize: 14,
        backgroundColor: '#f5f5f5',
        border: '1px solid #ddd',
        borderRadius: '4px',
        padding: '10px'
      }}
    />
  );
};

export default CustomStyledEditor;

Other packages similar to react-simple-code-editor

Keywords

FAQs

Package last updated on 30 Sep 2019

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc