Theming
Complete control over your editor's appearance
Customize every aspect of your LexKit editor with powerful theming capabilities. From CSS classes to Tailwind utilities, make your editor match your design system perfectly.
Theme System Overview
LexKit's theming system builds on Lexical's foundation while adding powerful customization options.
Extends Lexical's built-in theme system with additional properties for toolbar, containers, and custom extensions.
Use any CSS classes or Tailwind utilities. Full control over styling without framework restrictions.
Full TypeScript support with intelligent autocomplete and compile-time validation.
Quick Start
Get started with theming in just a few lines of code.
Create a custom theme object
Apply your theme to the editor
Tailwind CSS Example
See how to style your editor using pure Tailwind CSS classes.
Complete Tailwind theme example
Live Examples
See theming in action with these interactive examples.
Custom CSS Classes Theme
Using custom CSS classes for complete styling control
Dynamic Dark Mode Theme
Switch between light and dark themes dynamically
Theme: Light
Same component, different theme - no manual styling needed!
1. Theme Object Replacement: Replace the entire theme object (like the example above) for complete control.
2. Parent Container Classes: Add dark mode classes to parent containers and let CSS handle the styling cascade.
3. CSS Variables: Use CSS custom properties that change based on a dark mode class.
4. Hybrid Approach: Combine theme objects with CSS variables for maximum flexibility.
Custom CSS Classes Theme
Using custom CSS classes for complete styling control
Tailwind CSS Theme
Pure Tailwind utilities for modern, responsive styling
This editor is styled entirely with Tailwind CSS classes — no custom CSS files needed!
Theme Properties
Complete reference of all available theme properties.
| Category | Property | Description |
|---|---|---|
| Text Formatting | text.bold | Bold text styling |
| Text Formatting | text.italic | Italic text styling |
| Text Formatting | text.underline | Underline text styling |
| Text Formatting | text.strikethrough | Strikethrough styling |
| Text Formatting | text.code | Inline code styling |
| Content Elements | paragraph | Paragraph styling |
| Content Elements | heading.h1-h6 | Heading levels (h1 through h6) |
| Content Elements | quote | Blockquote styling |
| Content Elements | link | Link styling |
| Content Elements | image | Image styling |
| Category | Property | Description |
|---|---|---|
| Toolbar | toolbar.button | Base button styling |
| Toolbar | toolbar.buttonActive | Active button styling |
| Toolbar | toolbar.buttonDisabled | Disabled button styling |
| Toolbar | toolbar.group | Button group container |
| Containers | container | Main editor container |
| Containers | wrapper | Editor wrapper element |
| Containers | richText.contentEditable | Content editable area |
| Containers | richText.placeholder | Placeholder text |
| Extension | Property | Description |
|---|---|---|
| Draggable Blocks | draggable.handle | Drag handle styling |
| Draggable Blocks | draggable.handleHover | Hover state for drag handle |
| Draggable Blocks | draggable.blockDragging | Block being dragged styling |
| Draggable Blocks | draggable.dropIndicator | Drop zone indicator styling |
| Floating Toolbar | floatingToolbar.container | Toolbar container styling |
| Floating Toolbar | floatingToolbar.button | Toolbar buttons styling |
| Floating Toolbar | floatingToolbar.buttonActive | Active button state styling |
Extension-Specific Theming
Customize the appearance of specific extensions like draggable blocks and floating toolbar.
Extension-specific theme configuration
Advanced Usage
Take your theming to the next level with advanced techniques.
Combine themes or override specific properties without rewriting everything.
Theme merging example
Change themes dynamically based on user preferences or application state.
Dynamic theme switching example
Use CSS custom properties for dynamic color schemes and responsive design.
CSS Variables theme example
Apply different themes to different editor instances in the same application.
Component-level theming example
Best Practices
Tips for creating maintainable and performant themes.
Use your existing design system tokens and classes. Maintain consistency across your application by leveraging established patterns and variables.
Keep themes lightweight and avoid complex selectors. Use CSS custom properties for dynamic values to minimize re-renders.
Ensure sufficient color contrast and consider focus states. Test with screen readers and keyboard navigation to maintain usability.
Design themes that work across different screen sizes. Use responsive utilities and consider touch interactions for mobile devices.
Migration Guide
Upgrading from plain Lexical themes to LexKit theming.