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 🙏

© 2026 – Pkg Stats / Ryan Hefner

luxe-edit

v0.2.3

Published

A beautiful, customizable rich text editor for React built on Lexical with customizable toolbars and floating toolbar support

Downloads

745

Readme

luxe-edit

A beautiful, customizable rich text editor for React built on Lexical with customizable toolbars and floating toolbar support.

Live Demo →

Installation

npm install luxe-edit
# or
yarn add luxe-edit
# or
pnpm add luxe-edit

Quick Start

import { LuxeEditor } from 'luxe-edit';
import 'luxe-edit/index.css';

function App() {
  return <LuxeEditor initialConfig={{ namespace: 'MyEditor' }} />;
}

Props

| Prop | Type | Default | Description | |------|------|---------|-------------| | initialConfig | Partial<InitialConfigType> | required | Lexical editor config (namespace, theme, etc.) | | initialJSON | any | — | Pre-load editor with saved JSON state | | showToolbar | boolean | true | Show/hide the top toolbar | | showFloatingToolbar | boolean | true | Show/hide the floating selection toolbar | | editable | boolean | true | Enable/disable editing (read-only mode when false) | | toolbarItems | ToolbarItem[] | see below | Customize top toolbar buttons | | floatingToolbarItems | ToolbarItem[] | same as toolbarItems | Customize floating toolbar buttons | | onChange | (editorState, editor) => void | — | Called whenever the editor content changes | | ignoreInitialChange | boolean | true | Skip onChange on initial mount | | children | ReactNode | — | Render extra Lexical plugins inside the composer |

Toolbar Items

The toolbarItems and floatingToolbarItems props accept an array of ToolbarItem objects.

type ToolbarItemType =
  | 'undo' | 'redo' | 'divider'
  | 'bold' | 'italic' | 'underline' | 'strikethrough'
  | 'heading1' | 'heading2' | 'heading3' | 'heading4' | 'heading5' | 'heading6'
  | 'paragraph' | 'headingDropdown'
  | 'alignLeft' | 'alignCenter' | 'alignRight' | 'alignJustify'
  | 'textColor' | 'backgroundColor'
  | 'link' | 'fullscreen';

interface ToolbarItem {
  type: ToolbarItemType;
  label?: string;        // Custom label
  icon?: React.ReactNode; // Custom icon
  color?: string;        // Default color for textColor/backgroundColor (e.g. '#ff0000')
  colors?: string[];     // Custom color palette for color picker
}

Default toolbar:

const defaultToolbarItems = [
  { type: 'undo' },
  { type: 'redo' },
  { type: 'divider' },
  { type: 'bold' },
  { type: 'italic' },
  { type: 'underline' },
  { type: 'strikethrough' },
  { type: 'divider' },
  { type: 'headingDropdown' },
  { type: 'divider' },
  { type: 'link' },
];

Examples

Save and restore content

import { useState } from 'react';
import { LuxeEditor, getEditorJSON } from 'luxe-edit';
import 'luxe-edit/index.css';

function App() {
  const [savedJSON, setSavedJSON] = useState(null);

  return (
    <>
      <LuxeEditor
        initialConfig={{ namespace: 'MyEditor' }}
        initialJSON={savedJSON}
        onChange={(editorState) => {
          setSavedJSON(getEditorJSON(editorState));
        }}
      />
      <button onClick={() => console.log(savedJSON)}>Log JSON</button>
    </>
  );
}

Custom toolbar

<LuxeEditor
  initialConfig={{ namespace: 'MyEditor' }}
  toolbarItems={[
    { type: 'bold' },
    { type: 'italic' },
    { type: 'divider' },
    { type: 'textColor', colors: ['#000000', '#ef4444', '#3b82f6'] },
    { type: 'headingDropdown' },
    { type: 'fullscreen' },
  ]}
/>

Disable floating toolbar

<LuxeEditor
  initialConfig={{ namespace: 'MyEditor' }}
  showFloatingToolbar={false}
/>

Read-only mode (disable editing)

<LuxeEditor
  initialConfig={{ namespace: 'MyEditor' }}
  editable={false}
/>

Get plain text or markdown

import { getEditorText, getEditorFormattedText, getMarkdownFromJSON, getDOMFromJSON } from 'luxe-edit';

onChange={(editorState) => {
  const plain = getEditorText(editorState);        // Plain text
  const markdown = getEditorFormattedText(editorState); // Markdown-style text

  const json = editorState.toJSON();
  const markdownFromJSON = getMarkdownFromJSON(json); // Markdown from stored JSON
  const domFromJSON = getDOMFromJSON(json);           // HTML/DOM string from stored JSON
}}

Utility Functions

| Function | Signature | Description | |----------|-----------|-------------| | getEditorJSON | (editorState) => any | Serialized JSON — store in a database and reload with initialJSON | | getEditorText | (editorState) => string | Plain text content | | getEditorFormattedText | (editorState) => string | Markdown-formatted text | | getEditorDOM | (editor) => string | Raw HTML from the editor DOM | | getMarkdownFromJSON | (json) => string | Markdown-formatted text generated directly from stored JSON | | getDOMFromJSON | (json) => string | HTML/DOM string generated directly from stored JSON | | getEditorTree | (json) => any | Debug tree structure from JSON |

License

MIT