Control graphs with JavaScript
DesmosCalculator handles loading the API, initialization, and cleanup. Expressions and controls specific to an article stay in MDX.
Loading graph…
Choose the initial data
Pass exactly one of an expressions array, a saved state, or the hash at the end of a Desmos URL.
<DesmosCalculator expressions={expressions} />
<DesmosCalculator state={savedState} />
<DesmosCalculator hash="xfsfswckqy" showCaption />
With hash, the component fetches the saved state from Desmos and loads it through setState(). Add showCaption to link back to the original graph.
2D, 3D, and Geometry
Select the Desmos tool with kind. It defaults to 2d.
<DesmosCalculator kind="2d" expressions={expressions} />
<DesmosCalculator kind="3d" state={threeDimensionalState} />
<DesmosCalculator kind="geometry" hash="saved-geometry-hash" />
For more advanced custom components, use onReady or useDesmosCalculator() to access the Calculator instance.