Get StartedComponentsStylingThemingMath & Science
MCP

Science

Math

LaTeX rendering with KaTeX, themed to the surrounding text color. MathRenderer is the inline or display equation; FormulaBlock wraps one in a card with a title and a symbol legend.

KaTeX is an optional peer dependency. Install it and import its stylesheet once: npm i katex and import "katex/dist/katex.min.css". Without it the raw LaTeX is shown.

Markdown

Import

tsx
import { MathRenderer, FormulaBlock } from "@indoku/ui"import "katex/dist/katex.min.css"

Examples

Inline

The quadratic formula is x = \frac{-b \pm \sqrt{b^2 - 4ac}}{2a} for any equation of the form ax^2 + bx + c = 0.

Display

Centered display style with display.

\int_0^{\infty} e^{-x^2}\,dx = \frac{\sqrt{\pi}}{2}

FormulaBlock

Title, equation and a symbol legend.

Wave speed
The speed of a wave equals its frequency times its wavelength.
v = f\lambda
v
speed (m/s)
f
frequency (Hz)
\lambda
wavelength (m)

Fallback

Shown as monospace text while KaTeX loads.

E = mc^2

Props

MathRenderer

PropTypeDefaultDescription
latex*string–
displaybooleanfalse (inline)Centered display style.
katexKatexLike–Your KaTeX instance. Omit to import katex on demand.

FormulaBlock

PropTypeDefaultDescription
latex*string–
titleReactNode–
descriptionReactNode–
variables{ symbol: string; meaning: ReactNode }[]–Legend of symbols: symbol is LaTeX.
katexKatexLike–

* required. Style props and HTML attributes are accepted as well.

Accessibility

  • KaTeX output includes MathML for assistive technology.

Notes

  • Pass your own instance with the katex prop to skip the dynamic import.

Created by @indokudev