Luthor
DocumentationDemoPlaygroundGitHub
Luthor

A headless, extensible rich text editor built on Lexical. Ship faster with production-ready defaults and TypeScript-first APIs.

Documentation

IntroductionInstallation@lyfie/headless@lyfie/luthor

Resources

DemoPlaygroundGitHubnpm Package

Support the Project

Buy me a coffeeStar on GitHub

Built with love by developers for developers.

DocsGitHubllms.txtllms-full.txt
  1. Home
  2. Docs
  3. Luthor Headless
  4. Features
  5. Typography And Text

Luthor Documentation

Getting Started

  • Introduction
  • Installation
  • @lyfie/headless
  • @lyfie/luthor

@lyfie/headless

  • Features
  • Typography and Text
  • Structure and Lists
  • Media and Embeds
  • Code and Devtools
  • Interaction and Productivity
  • Customization and Theming

@lyfie/luthor

  • Presets
  • Extensive
  • Simple Text
  • Rich Text
  • Chat Window
  • Email Compose
  • Markdown
  • Notion Like
  • Headless Preset
  • Notes

Typography and Text

This group covers typography, essentials, and color controls.

Included extensions

  • boldExtension, italicExtension, underlineExtension, strikethroughExtension
  • subscriptExtension, superscriptExtension, codeFormatExtension
  • fontFamilyExtension, fontSizeExtension, lineHeightExtension
  • textColorExtension, textHighlightExtension

Example

tsx
import {
  createEditorSystem,
  RichText,
  richTextExtension,
  boldExtension,
  italicExtension,
  underlineExtension,
  fontFamilyExtension,
  fontSizeExtension,
  lineHeightExtension,
  textColorExtension,
  textHighlightExtension,
} from '@lyfie/luthor-headless';

const extensions = [
  richTextExtension,
  boldExtension,
  italicExtension,
  underlineExtension,
  fontFamilyExtension,
  fontSizeExtension,
  lineHeightExtension,
  textColorExtension,
  textHighlightExtension,
] as const;

const { Provider, useEditor } = createEditorSystem<typeof extensions>();

function Toolbar() {
  const { commands, activeStates } = useEditor();
  return (
    <div>
      <button onClick={() => commands.toggleBold?.()} aria-pressed={activeStates.bold === true}>Bold</button>
      <button onClick={() => commands.toggleItalic?.()} aria-pressed={activeStates.italic === true}>Italic</button>
      <button onClick={() => commands.setTextColor?.('#2563eb')}>Blue</button>
      <button onClick={() => commands.setTextHighlight?.('#fef08a')}>Highlight</button>
    </div>
  );
}

export function App() {
  return (
    <Provider extensions={extensions}>
      <Toolbar />
      <RichText placeholder="Type styled content..." />
    </Provider>
  );
}

Relevant props

  • RichText.placeholder: undefined (default) | string
  • RichText.disabled: false (default) | true
Previous: Features
Next: Structure and Lists