A world-class math input for the web
1import { createCaretVDOMComponent, h } from "@caret-js/core";
2import { radicalTokenType } from "../tokens/radical";
3
4export const RadicalTokenComponent = createCaretVDOMComponent<
5 typeof radicalTokenType
6>(({ token, children }) => {
7 const { isSqrt } = token.props;
8
9 return h(
10 "span",
11 { class: "radical" },
12 !isSqrt && h("span", { class: "radical-index" }, children.get("index")),
13 h("span", { class: "radicand" }, children.get("radicand")),
14 );
15});