konstantinmuenster / lexical-floating-menu

Designed for @lexical/react. Headless & fully-customizable.

Home Page:https://lexical-floating-menu.vercel.app

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

🌬️ lexical-floating-menu

Designed for @lexical/react. Headless & fully customizable.

Improve your text editing experience with an intuitive floating menu / bubble menu.

📌 Live Demo: lexical-floating-menu.vercel.app


lexical floating menu


Getting Started

Install

npm install lexical-floating-menu

Note: Make sure you have all peer dependencies installed.

Configure

lexical-floating-menu exports a React component that can be included as a plugin within your editor.

import { FloatingMenuPlugin } from "lexical-floating-menu";
import { YourFloatingMenuUI } from "../components/FloatingMenu";

export function LexicalEditor(props: LexicalEditorProps) {
  return (
    <LexicalComposer initialConfig={props.config}>
      {/** ... other plugins (e.g. RichTextPlugin) */}
      <FloatingMenuPlugin
        // This component represents the rendered menu. You can include any formatting
        // options. FloatingMenuPlugin takes care of rendering it at the right position.
        MenuComponent={YourFloatingMenuUI}
        // optional – Define to which HTML element the menu gets appended to
        element={document.body}
      />
    </LexicalComposer>
  );
}

Take a look at the Storybook example to see how your FloatingMenu component could look like.


About

Buy Me A Coffee

Konstantin Münster – konstantin.digital

Distributed under the MIT license. See LICENSE for more information.

https://github.com/konstantinmuenster

About

Designed for @lexical/react. Headless & fully-customizable.

https://lexical-floating-menu.vercel.app

License:MIT License


Languages

Language:TypeScript 97.3%Language:JavaScript 1.8%Language:CSS 0.7%Language:HTML 0.2%