MathFormula

Markdown

LaTeX formulas, rendered with KaTeX and readable by screen readers.

Use it for
LaTeX formulas with accessible MathML.
Not for
Whole Markdown replies. Try RichMarkdownResponse.

MathFormula preview

Loading example…

Installation

npm install @stackunseen/ui katex
import { MathFormula } from '@stackunseen/ui/math';
Styles: @stackunseen/ui/styles.css

Usage and props

Use inline within a sentence, block for a standalone equation and scroll for a wide formula. Import the KaTeX stylesheet in your application. Load the KaTeX CSS. Formulas can’t run commands, and their size is capped.

formulastring
TeX source, up to 10,000 characters. Invalid or longer input shows a source preview and message.
labelstring (optional)
An accessible name. Defaults to Mathematical formula.
How state and callbacks work
All props

Loading…

For your coding agent

Give the agent this page instead of a screenshot. The prompt wraps the page with the install and import lines and the rule that your server, not a click, completes an action.

Contract
formula · label? · variant
Keeps honest
Load the KaTeX CSS. Formulas can’t run commands, and their size is capped.
MCP
read_component "MathFormula" on the docs endpoint
Open the Markdown file

Keyboard and customization

Keyboard

Tab reaches the formula or fallback source for keyboard reading and scrolling. The output includes MathML; test it with the screen readers you support.

Customization

Change shared colors, spacing, corners and icons with the theme. Use the component's supported props to adapt its content and layout. Customization guide and Theme Studio