@prosekit/preact package, offering Preact-specific components, hooks, and utilities for building powerful editors with a smaller bundle size.
Installation
preact>= 10.11.0
Quick Start
Create a basic editor with Preact:Core Components
ProseKit
The root component that provides editor context to all child components.editor: The editor instance created withcreateEditor()children?: Child components
Essential Hooks
useEditor
Retrieves the editor instance from the nearestProseKit component.
update?: boolean- Whether to re-render when editor state updates (default:false)
useEditorDerivedValue
Compute and subscribe to derived values from the editor state.useExtension
Dynamically add extensions to the editor.editor?: Editor- Optional editor instance (defaults to context editor)priority?: Priority- Extension priority
useKeymap
Define keyboard shortcuts.useDocChange
Execute a callback when the document changes.useStateUpdate
Execute a callback on every state update (including selection changes).Custom Node Views
Create interactive node views with Preact components:node- The ProseMirror nodeview- The editor viewgetPos- Function to get node positionsetAttrs- Function to update node attributesdecorations- Node decorationsselected- Whether the node is selected
Custom Mark Views
Create custom mark rendering with Preact:UI Components
ProseKit provides pre-built Preact components for common editor UI patterns:Autocomplete
Inline Popover
Tooltip
Popover
Block Handle
Table Handle
Resizable
TypeScript Support
ProseKit has full TypeScript support with type inference:Preact Signals
ProseKit works well with Preact’s signals for fine-grained reactivity:Bundle Size Optimization
Preact’s smaller bundle size makes it ideal for performance-critical applications:React Compatibility
Preact can use React libraries withpreact/compat:
Server-Side Rendering (SSR)
ProseKit supports server-side rendering with Preact:Examples
Check out full working examples:Next Steps
Extensions
Learn about available extensions
Commands
Explore editor commands
Styling
Customize editor appearance
API Reference
Full API documentation