npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

@opentf/react-code-editor

v0.10.0

Published

A simple code editor for React JS.

Downloads

31

Readme

 OPEN TECH FOUNDATION

React Code Editor

Screenshot

A simple code editor for React JS, useful for form code input.

Features

  • Simple Editor (HTML Textarea based)

  • Syntax Highlighting

  • Multiple languages & themes are supported.

  • Format code with Prettier

  • Syntax Errors via Prettier formating

  • Line numbers

Installation

npm install @opentf/react-code-editor
yarn add @opentf/react-code-editor
pnpm add @opentf/react-code-editor
bun add @opentf/react-code-editor

Usage

import { Editor } from '@opentf/react-code-editor';

export default function App() {
  const code = `export default function App() {
      return <h1>Hello world</h1>
    }
  `;

  return <Editor value={code} onChange={handleChange} />;
}

Props

| Name | Type | Required | Default | Description | | --------- | -------- | -------- | ------------ | -------------------------------------------------------------------------------------------------------------- | | value | string | Yes | '' | The value of the editor. | | onChange | Function | No | undefined | The handler function for the value change event. | | themes | Theme[] | No | [] | You can pass aditional themes to the editor via this prop. | | languages | Lang[] | No | [] | By default only limited set of languages supported, you can extend additional languages support via this prop. | | lang | string | No | 'Plain Text' | The language syntax highlighting. | | theme | string | No | 'Light' | The theme name to apply a theme. See list of themes below. | | style | object | No | {} | The styles will be applied to the root element of the editor component. | | title | string | No | 'Untitled' | The editor title. Eg: Config.json | | config | object | No | {} | See the below table for config object. |

Config:

| Name | Type | Required | Default | Description | | ---------- | ------ | -------- | ------- | ------------------------------------------------------------ | | indent | string | No | 'Space' | Indent code using "Space" or "Tab" | | indentSize | number | No | 2 | The indent size. | | textArea | object | No | {} | Any additional props for the code editor textarea element. |

Supported Languages (With formatting)

✔️ JSON

⏳ HTML

⏳ JavaScript

⏳ TypeScript

⏳ CSS

⏳ GraphQL

⏳ TOML

⏳ YAML

Supported Languages (Without formatting)

✔️ Plain Text

⏳ Bash

⏳ Dockerfile

Supported Themes

  • Dark

  • Light (Default)

💡You can create your own themes easily, please refer any existing theme objects in the repo.

License

Copyright (c) Thanga Ganapathy (MIT License).