Theming & Styling
@qalma/editor is headless. It ships no component styles and does not depend on
Tailwind or a design system. The consuming application owns all presentation.
CSS hooks
| Hook | Where it appears |
|---|---|
.qalma-editor |
Host class on <qalma-editor>. |
.qalma-content |
Host class on <qalma-content>. |
.qalma-content-surface |
Internal mount element inside <qalma-content>. |
.qalma-toolbar |
Host class on <qalma-toolbar>. |
.qalma-command-active |
Added to button[qalmaCommand] when command state is active. |
.ProseMirror |
The editable ProseMirror element mounted inside the content surface. |
Minimal styles:
qalma-content .ProseMirror {
outline: none;
white-space: pre-wrap;
word-break: break-word;
}
Style document content
Document HTML comes from your plugins, so style the resulting elements.
qalma-content .ProseMirror h2 {
margin-block: 1rem 0.5rem;
font-size: 1.5rem;
font-weight: 700;
}
qalma-content .ProseMirror ul {
list-style: disc;
padding-left: 1.5rem;
}
qalma-content .ProseMirror blockquote {
border-left: 4px solid var(--accent);
padding-left: 1rem;
}
Tailwind
Tailwind works well because Qalma exposes normal DOM.
<qalma-content
class="block min-h-64 p-4
[&_.ProseMirror]:outline-none
[&_.ProseMirror_h2]:text-2xl [&_.ProseMirror_h2]:font-bold
[&_.ProseMirror_ul]:list-disc [&_.ProseMirror_ul]:pl-6
[&_.ProseMirror_blockquote]:border-l-4 [&_.ProseMirror_blockquote]:pl-4"
/>
Keep Tailwind in the app. Do not move product styling into editor plugins.
Design tokens and component systems
The docs app uses a shadcn/spartan-ng token contract in apps/docs/src/styles.css
and the QalmaButton directive from @qalma/kit, an optional, separately
published Tailwind-styled UI kit. @qalma/editor itself does not depend on it —
you can wrap native <button> and <a> elements with your own component
system just as easily.
The same pattern works for any component system:
<button
type="button"
qalmaBtn
variant="ghost"
size="icon"
qalmaCommand="toggleBold"
aria-label="Bold"
>
B
</button>
Placeholder styles
PlaceholderPlugin adds a class and data-placeholder. You render the visible
placeholder text with CSS.
.qalma-placeholder::before {
content: attr(data-placeholder);
color: var(--muted-foreground);
float: left;
height: 0;
pointer-events: none;
}
Selected nodes
Selectable nodes such as images use ProseMirror's selected-node class.
qalma-content .ProseMirror .ProseMirror-selectednode {
outline: 2px solid var(--accent);
outline-offset: 2px;
}