SVG
ImportMiso.Svg to access all SVG element constructors and SVG event handlers in a single module:
Miso.Svg re-exports:
Miso.Svg.Element— element constructorsMiso.Svg.Event— SVG-specific event attributes
Miso.Svg.Property directly.
Elements
All SVG elements are rendered using theSVG namespace (http://www.w3.org/2000/svg) via document.createElementNS. The API mirrors HTML elements — a trailing underscore, a list of attributes, and a list of children.
Basic SVG example
This example is taken directly from theMiso.Svg module documentation:
Building a scene
MathML
For mathematical notation, miso also providesMiso.Mathml, which works the same way as Miso.Svg but renders elements in the MathML namespace. See the MathML example (live demo).
Canvas 2D
TheMiso.Canvas module provides a monadic API for the Canvas 2D rendering context. The Canvas monad wraps a ReaderT CanvasContext2D IO computation.
Embedding a canvas in the view
Use thecanvas function to embed a <canvas> element:
canvas_ variant (with the underscore) is lower-level and not specialized to ReaderT — it is useful when integrating with libraries like Three.js.
Canvas API
Basic Canvas example
StyleArg
The StyleArg type unifies colors, gradients, and patterns for use with fillStyle and strokeStyle: