Option 1: Install with shadcn/ui (Recommended)
The quickest way to get started with ProseKit is to install a pre-built example that includes a full-featured editor with toolbar, inline menu, slash commands, and more:- Rich text formatting (bold, italic, underline, strike-through)
- Headings, lists, blockquotes, and code blocks
- Tables and images
- Inline formatting menu
- Slash commands for quick actions
- Block drag handles
- And much more!
Option 2: Manual Installation
If you prefer to build from scratch or aren’t using shadcn/ui, you can install ProseKit manually:Create a new component file for your editor. Here’s a minimal example that includes basic formatting features:
Understanding the Code
Let’s break down what’s happening in the minimal editor example:-
Import styles: The basic styles (
prosekit/basic/style.css) are required for the editor to function. The typography styles (prosekit/basic/typography.css) provide beautiful default styling for your content. -
Create extension:
defineBasicExtension()provides a complete set of common editing features including:- Text nodes and paragraphs
- Headings (h1-h6)
- Bold, italic, underline, strike-through formatting
- Lists (ordered and unordered)
- Blockquotes and code blocks
- Links, images, and tables
- Keyboard shortcuts and undo/redo
-
Create editor:
createEditor()initializes the editor with your extension configuration. -
Mount the editor: The
<ProseKit>component provides context, and theeditor.mountref attaches the editor to a DOM element.
What You Get Out of the Box
WithdefineBasicExtension(), your editor supports:
- Text Formatting: Bold (Cmd+B), Italic (Cmd+I), Underline (Cmd+U)
- Headings: # for H1, ## for H2, etc.
- Lists: Type
-for bullet lists,1.for ordered lists - Code: Inline code with backticks, code blocks with triple backticks
- Links: Cmd+K to insert links
- Undo/Redo: Cmd+Z and Cmd+Shift+Z
- And more: Blockquotes, tables, images, horizontal rules
Next Steps
Now that you have a working editor, explore these guides to learn more:First Editor Tutorial
Step-by-step tutorial building an editor from scratch
Installation Guide
Detailed installation options and framework-specific setup
Styling
Learn how to customize the appearance of your editor
Extensions
Explore available extensions and learn to create your own
The examples above use
defineBasicExtension() which includes many features. In the First Editor Tutorial, you’ll learn how to compose your own custom extension from individual pieces.