Theming
SynclineMDX Editor is fully themeable via CSS custom properties. Override any --smdx-* variable to match your brand — no build step required.
Theme via Config
Pass a theme object (CSS variable map) to createEditor():
editor.ts
Dark Mode
Dark mode is toggled by adding the .smdx-dark CSS class to the editor root or any parent element. The package ships with a built-in dark palette:
Light (default)
Dark (.smdx-dark)
dark-theme.css
Toggle with JavaScript
dark-mode.ts
All CSS Variables
All design tokens are defined as CSS custom properties on .smdx-editor:
editor.css
Brand Theme
Only override the tokens you need:
brand.css
React Integration
Use useRef + useEffect to mount the editor and toggle dark mode reactively:
ThemedEditor.tsx
CSS Variable Reference
| Variable | Light | Dark | Description |
|---|---|---|---|
--smdx-primary | #6366f1 | #818cf8 | Accent / brand colour |
--smdx-primary-hover | #4f46e5 | #6366f1 | Accent hover state |
--smdx-bg | #ffffff | #1e1e2e | Overall editor background |
--smdx-bg-muted | #f8fafc | #2a2a3c | Muted surface background |
--smdx-text | #1e293b | #e2e8f0 | Primary text colour |
--smdx-text-muted | #64748b | #94a3b8 | Secondary / muted text |
--smdx-border | #e2e8f0 | #374151 | Border and divider colour |
--smdx-border-focus | #6366f1 | #818cf8 | Focus ring colour |
--smdx-font-family | system-ui | system-ui | UI and prose font |
--smdx-font-mono | monospace | monospace | Code font family |
--smdx-font-size | 14px | 14px | Base font size |
--smdx-radius | 8px | 8px | Border radius for elements |
--smdx-toolbar-btn-size | 32px | 32px | Toolbar button size |
© 2026 SynclineMDX Editor. All rights reserved.