<link rel="stylesheet" href="https://fonts.googleapis.com/css2?family=Fraunces:ital,opsz,wght@0,9..144,400..600;1,9..144,400..600&family=Imperial+Script&family=Inter:wght@400;500;600&family=JetBrains+Mono:wght@400;500&display=swap" />

Search the Qalma docs

Type at least two characters to get started.

Docs

Character Count

CharacterCountPlugin exposes a reactive query and can reject edits that grow the document beyond a configured limit.

const editor = createQalmaEditor({
  plugins: [CharacterCountPlugin.configure({ limit: 2_000 })],
});

readonly count = computed(
  () => this.editor.query<CharacterCountState>('characterCount')!,
);

The state contains characters, words, limit, remaining, and isOverLimit. The default grapheme mode counts a family emoji or combined accent as one visible character; choose mode: 'codePoint' for code-point counting.

A limited plugin blocks transactions that increase an over-limit document, but still permits deletions. setHtml() and document restoration remain explicit application operations and may load over-limit content; the query reports that state so your UI can explain it.

<p aria-live="polite">{{ count().characters }} / {{ count().limit }} characters</p>