Documentation Index
Fetch the complete documentation index at: https://mintlify.com/devscribe-team/webeditor/llms.txt
Use this file to discover all available pages before exploring further.
Introduction
WebEditor comes with a comprehensive set of built-in components that can be inserted directly into your content. These components are accessible via the command menu (press/ in an empty paragraph) and provide rich, interactive content elements.
Architecture
WebEditor’s component system is built on top of ProseMirror’s node system. Each component is:- A ProseMirror Node: Defined with a
NodeSpecthat specifies its structure, attributes, and parsing rules - A React NodeView: Rendered as a React component with full access to React hooks and state
- Insertable via Commands: Accessible through the command menu with keyboard shortcuts
- Serializable: Can be converted to/from HTML for persistence
Component lifecycle
Available components
Block components
Block components occupy their own line and can contain other content.Inline components
Inline components can be inserted within text paragraphs.Component categories
Content containers
Components that hold and organize other content:- Card: Display content in a styled card with optional icon and title
- Callout: Highlight important information with contextual styling (info, warning, caution, tip, important)
- Accordion: Create collapsible sections for better content organization
- Tabs: Organize content into switchable tabs
- Field: Display form-like fields with labels and descriptions
- Columns: Create multi-column layouts
Code and diagrams
Components for technical content:- Code Snippet: Syntax-highlighted code blocks with language support (JavaScript, TypeScript, Python, Rust, SQL, CSS, HTML)
- Mermaid: Render flowcharts, diagrams, and graphs using Mermaid syntax
Media and embeds
Components for external content:- Frame: Embed external content via iframe with configurable dimensions
Visual elements
Components for visual enhancement:- Badge: Inline status indicators or labels with variant styles (default, secondary, destructive, outline)
- Icon: Display Lucide icons inline with customizable size
- Break: Visual separator or spacer
- Steps: Numbered step-by-step instructions
Component attributes
Each component supports different attributes that can be configured:Card attributes
The card’s heading text
Lucide icon name (e.g., “FileText”, “Star”, “Book”)
Whether to display the icon
Layout orientation: horizontal or vertical
Optional link URL to make the card clickable
Callout attributes
Callout style:
info, warning, caution, tip, or importantCode snippet attributes
Programming language for syntax highlighting
Whether to display line numbers
Code editor theme (github, github-dark, tokyo-night, vscode)
Badge attributes
Badge style:
default, secondary, destructive, or outlineBadge text content
Using components
Via command menu
The easiest way to insert components is through the command menu:- Place cursor in an empty paragraph
- Press
/to open the command menu - Type to search for a component
- Select with arrow keys and press Enter
- Configure component attributes in the modal (if applicable)
Via markdown syntax
You can also type component syntax directly:Programmatically
For advanced use cases, you can insert components programmatically using the insert functions:Editing components
Wheneditable={true}, components can be edited by:
- Clicking: Click on component titles, icons, or attributes to open edit modals
- Keyboard: Use Tab to focus components, Enter/Space to edit
- Hover options: Some components show additional options on hover (e.g., Card layout toggle)
Edit modals
Many components open modal dialogs for editing:- Title/Description modals: Edit text content
- Icon modals: Search and select Lucide icons
- Type modals: Change component variants (e.g., Callout type)
- Code modals: Edit code with syntax highlighting
Component styling
All components use Tailwind CSS for styling and support both light and dark themes automatically.Theme-aware components
Components automatically adapt to the active theme:Customization
You can customize component appearance by:- CSS variables: Override Tailwind theme variables
- Tailwind config: Extend the default theme
- Custom styles: Add additional CSS classes
Creating custom components
To create your own components:- Define a
NodeSpecwith the component schema - Create a React
NodeViewcomponent - Add parsing rules for HTML/markdown
- Register the component in the editor schema
- Add an insert function and command
Best practices
Component design guidelines
- Keep components focused on a single purpose
- Provide sensible default attributes
- Make components editable with clear UI affordances
- Support both light and dark themes
- Use semantic HTML for accessibility
- Test with keyboard navigation
Performance tips
- Lazy load icons: The dynamic icon loader caches loaded icons
- Memoize render: Use React.memo for expensive components
- Avoid re-renders: Use
contentEditable={false}for non-editable parts - Optimize modals: Only render modals when open
See also
- WebEditor - Main editor component documentation
- useTheme Hook - Theme management
- Quickstart - Get started with WebEditor