Formula
Renders real LaTeX math notation via KaTeX, with graceful fallback rendering for invalid expressions and a MathML tree for screen readers.
Installation
npx dafink-ui add formulaRequires: katex
Demo
Props
| Name | Type | Default | Description |
|---|---|---|---|
| expression | string | - | Required. A LaTeX math expression, e.g. "x^2", "\frac{a}{b}", "\sum_{i=1}^{n} x_i". Rendered with KaTeX. |
| display | "inline" | "block" | "inline" | "inline" flows with surrounding text as a <span>. "block" centers the formula on its own line as a <div>. |
| size | "sm" | "md" | "lg" | "md" | Font size of the rendered formula: text-sm, text-base, or text-lg. |
| className | string | "" | Additional Tailwind classes merged onto the root wrapper. |