Features
Libraries
A standalone LaTeX editor with a source pane beside the live KaTeX formula, over a symbol palette.
Installation#
bash
pnpm dlx shadcn@latest add @zui/math-editorUsage#
tsx
import { MathEditor } from '@/components/editor/math/react';tsx
function Formula() {
return <MathEditor defaultValue="E = mc^2" onValueChange={save} />;
}It is controlled when given value, and starts from defaultValue otherwise. FormulaViewer draws a stored formula without the editing pane, and MathPalette is the symbol and template menu on its own.
API reference#
MathEditor#
| Prop | Type | Default |
|---|---|---|
value | string | - |
defaultValue | string | - |
onValueChange | (source: string) => void | - |
readOnly | boolean | false |
layout | 'auto' | 'split' | 'tabs' | 'auto' |
toolbar | boolean | true |
className | string | - |
With layout="auto" the source and the formula sit side by side on a wide viewport and in tabs on a narrow one.