React
Interfaces
OrbitMindMapProps
What <OrbitMindMap> takes: the map, the renderer’s options as props, and a <div>’s own attributes.
Extends
OrbitRendererOptions.Omit<HTMLAttributes<HTMLDivElement>,"children">
Properties
| Property | Type | Description | Inherited from |
|---|---|---|---|
actions? |
OrbitAction[] |
Your own buttons under the focused node and in its detail sheet, before the registered ones. | OrbitRendererOptions.actions |
animation? |
boolean |
Keep the orbit turning slowly on its own. | OrbitRendererOptions.animation |
ariaLabel? |
string |
The map’s accessible name. Default: the document’s title. |
OrbitRendererOptions.ariaLabel |
baseUrl? |
string |
Resolves relative image, video, sound and link URLs: an http, https or file address, or a relative one, which the page’s address completes. Joined to a base of any other kind, such as javascript:, they’d take its scheme, so they stay relative instead. |
OrbitRendererOptions.baseUrl |
data? |
OrbitNode |
A node tree, for maps built in code. | - |
document? |
OrbitDocument |
A parsed document. Its frontmatter options apply unless a prop overrides them. | - |
editable? |
boolean |
Build the map on the map: a + in the orbit adds an idea, typed right in its new planet, and a long press, a right click or F2 edits a node’s text where it is. A node held still, by a long press or the mouse, lifts: drag it onto another node to move it there, or to a place in the orbit to put it there. Default false. | OrbitRendererOptions.editable |
editingKeys? |
boolean |
Keys for building an editable map at speed, as in mind-map apps. On a node with keyboard focus, Tab (or Insert) adds an idea under it, Shift+Enter adds one beside it, and Delete removes it. While typing, Tab keeps what was typed and goes on a level down, under it; with nothing typed, it moves the field under the idea before. Shift+Tab goes on a level up, beside the parent. Tab then stays in the map; Shift+Tab from a node still leaves it. Default false. | OrbitRendererOptions.editingKeys |
focus? |
string |
The node in focus when the map first draws, by id: to open a map where the reader left it. Default: the root. Later renders keep the reader’s place. | OrbitRendererOptions.focus |
focusedId? |
string |
The focused node’s id, to control focus from your state. The map flies to it when it changes; pair it with onFocusChange to follow the reader. |
- |
insets? |
OrbitInsets |
The parts of the map the page covers with its own controls, such as a toolbar floating over its bottom edge, in px from each edge. Views are fitted into what’s left, and the map still draws under the controls. Changing them moves a fitted view to its new place (see insetsTransition). |
OrbitRendererOptions.insets |
insetsTransition? |
"instant" | "glide" |
How the insets a setOptions call brings take effect, for that call alone. By default ('instant') a fitted view is kept within its new room at once, as it has to be while the keyboard slides or a sheet is dragged and the insets change every frame. 'glide' glides it all the way from where it was, with the camera, for a change made once, such as a panel coming or going. |
OrbitRendererOptions.insetsTransition |
interactive? |
boolean |
false draws a still picture: no clicks, drags, zoom or keyboard. Default true. |
OrbitRendererOptions.interactive |
language? |
string |
The language of the map’s controls, sheets and announcements: a BCP 47 tag such as es or pt-BR. Default: the language the map’s element is in (the closest lang attribute), then English. Orbit speaks English, Spanish and Brazilian Portuguese; registerLanguage adds others. |
OrbitRendererOptions.language |
longPressDelay? |
number |
How long (ms) a finger or pen holds still on a node before it counts as a long press (see onNodeContext). Default 500; apps can pass their platform’s own, such as Android’s 400. |
OrbitRendererOptions.longPressDelay |
maxDepth? |
number |
Levels below the root to render (1 = root + direct children). | OrbitRendererOptions.maxDepth |
mediaViewer? |
boolean |
Deprecated Use showMediaViewer, named as showRings and the other switches are: this name goes in Orbit 1.0. |
OrbitRendererOptions.mediaViewer |
nodeTypeFor? |
(node) => string | undefined |
The type a node that names none is drawn as, for display only: as if it said type: name, with that type’s look, content and actions. Orbit never writes it to the map, and asks again whenever it draws; return undefined to draw the node as it is. Called often: keep it quick. |
OrbitRendererOptions.nodeTypeFor |
nodeTypes? |
Record<string, OrbitNodeType> |
Node types by name: what nodes with type: name look like, draw inside them, show in the detail sheet and offer as actions. They come before the ones registered with registerNodeType. |
OrbitRendererOptions.nodeTypes |
noteRenderer? |
(note, context) => string |
Renders a note to HTML yourself. The HTML is used as-is: sanitize untrusted notes. | OrbitRendererOptions.noteRenderer |
onAction? |
(event) => false | void |
A button was pressed. Return false to skip what it does (the detail sheet, the link, or your action’s run). |
OrbitRendererOptions.onAction |
onEdit? |
(edit) => void |
The map was edited with addNode, updateNode, removeNode or moveNode; save renderer.toMarkdown() to keep it. |
OrbitRendererOptions.onEdit |
onEditorClose? |
(event) => void |
The field for typing on the map closed. | OrbitRendererOptions.onEditorClose |
onEditorOpen? |
(event) => void |
The field for typing on the map opened. | OrbitRendererOptions.onEditorOpen |
onFileOpen? |
(event) => false | void |
One of a node’s files was opened in the detail sheet. Return false to open it your way instead of in a new tab. |
OrbitRendererOptions.onFileOpen |
onFocusChange? |
(node, path) => void |
A new node is in focus, with the path from the root to it, as focus-change has them. |
OrbitRendererOptions.onFocusChange |
onMediaClose? |
(event) => void |
The media viewer closed. | OrbitRendererOptions.onMediaClose |
onMediaOpen? |
(event) => void |
The media viewer opened, or stepped to another picture, video or sound. | OrbitRendererOptions.onMediaOpen |
onMediaState? |
(state) => void |
The video, sound or live photo’s motion in the media viewer started, paused, moved on, ended or was muted; while it plays, its time a few times a second. | OrbitRendererOptions.onMediaState |
onNodeClick? |
(node) => void |
A node was clicked or activated with the keyboard, before the map reacts. | OrbitRendererOptions.onNodeClick |
onNodeContext? |
(event) => void |
A node was long-pressed, right-clicked or chosen with the context menu key: show a menu of things to do with it at (x, y). With this callback or a node-context listener, the press is yours: it doesn’t open the node, and the browser’s own menu stays closed. |
OrbitRendererOptions.onNodeContext |
onNodeDrag? |
(event) => void |
A node is dragged somewhere else (see editable and the node-drag event). |
OrbitRendererOptions.onNodeDrag |
onSpinSettle? |
(node) => void |
Called when a flicked orbit comes to rest, with the planet nearest the top. | OrbitRendererOptions.onSpinSettle |
onSpotlight? |
(event) => void |
A node spotlight brought up close moved on screen, came to rest there, or is back in its place. |
OrbitRendererOptions.onSpotlight |
onViewModeChange? |
(mode) => void |
- | OrbitRendererOptions.onViewModeChange |
openFiles? |
boolean |
Whether the detail sheet opens a node’s files: with false it lists them, each with its name, kind and size, and says they stayed with the map, as in a web page made without them. Default true. |
OrbitRendererOptions.openFiles |
orbitAnimation? |
boolean |
Deprecated Use animation, as a document writes it: this name goes in Orbit 1.0. |
OrbitRendererOptions.orbitAnimation |
orbitSpeed? |
number |
Deprecated Use speed, as a document writes it: this name goes in Orbit 1.0. |
OrbitRendererOptions.orbitSpeed |
palette? |
string[] |
Node colors: the first for the root, then one per top-level branch (cycling). Default: the theme’s. | OrbitRendererOptions.palette |
showActionButtons? |
boolean |
Buttons under the focused node for its note, media, link and actions. Default true. | OrbitRendererOptions.showActionButtons |
showControls? |
boolean |
Breadcrumbs, the view switch, the list button and zoom buttons. Default true. | OrbitRendererOptions.showControls |
showDetailSheet? |
boolean |
Open the built-in detail sheet for notes, embeds and the details of a node’s type. Default true. | OrbitRendererOptions.showDetailSheet |
showMediaViewer? |
boolean |
Show pictures, videos and sounds in the media viewer, over the whole window: “View picture”, “Play video” and “Play sound” open it, and so do the detail sheet’s pictures and its videos’ and sounds’ Expand buttons. Default true. With false, those buttons open the detail sheet instead (unless showDetailSheet is false too), whose videos and sounds then have no Expand button. openMedia opens the viewer either way. |
OrbitRendererOptions.showMediaViewer |
showRings? |
boolean |
Draw the dashed orbit rings. Default true. | OrbitRendererOptions.showRings |
source? |
string |
Markdown or YAML source, parsed with parseOrbit. Its frontmatter options apply unless a prop overrides them. |
- |
speed? |
number |
Seconds per turn of animation’s drift: bigger is slower. Default 90. |
OrbitRendererOptions.speed |
spin? |
OrbitSpinOptions |
How a flicked orbit spins. | OrbitRendererOptions.spin |
staticFallback? |
boolean |
Render a static SVG of the map until the live one mounts, so server rendering and slow connections show the map right away. Default true. | - |
statuses? |
Record<string, OrbitStatusStyle> |
Status words and how they look: a dot tone (active, done, blocked, todo, neutral) or any CSS color, as in { review: 'active', 'on hold': '#A855F7' }. |
OrbitRendererOptions.statuses |
strings? |
Partial<OrbitStrings> |
Words to change on this map only, over its language’s: { zoomIn: 'Closer' }. |
OrbitRendererOptions.strings |
theme? |
| OrbitThemePreset | OrbitRendererTheme | string & object |
A theme name ('night', 'cosmos', or one registered with registerTheme) or a theme object. An object without a preset keeps the document’s theme and changes the tokens it names. |
OrbitRendererOptions.theme |
transitionDuration? |
number | "auto" |
Navigation flight length in milliseconds, or auto to scale with the distance travelled. |
OrbitRendererOptions.transitionDuration |
view? |
OrbitViewMode |
The first view: focus (default) or all, the overview. |
OrbitRendererOptions.view |
viewMode? |
OrbitViewMode |
Deprecated Use view, as a document writes it: this name goes in Orbit 1.0. |
OrbitRendererOptions.viewMode |
zoom? |
OrbitZoomOptions |
How the wheel, trackpads and pinches zoom. | OrbitRendererOptions.zoom |
OrbitMindMapRef
Properties
| Property | Modifier | Type | Description |
|---|---|---|---|
renderer |
readonly |
OrbitSVGRenderer | null |
The renderer, once the map has mounted. |
Methods
endSpotlight()
endSpotlight(): void;Takes the node spotlight brought up close back to its place.
Returns
void
fit()
fit(): void;Returns the camera to the fitted view.
Returns
void
flyTo()
flyTo(nodeId): boolean;Flies to a node by id, in focus mode. Returns false when there’s no such node.
Parameters
| Parameter | Type |
|---|---|
nodeId |
string |
Returns
boolean
getNodeCircle()
getNodeCircle(nodeId): OrbitNodeCircle | null;Where a node is drawn on screen now (see OrbitSVGRenderer.getNodeCircle), or null.
Parameters
| Parameter | Type |
|---|---|
nodeId |
string |
Returns
OrbitNodeCircle | null
getViewMode()
getViewMode(): OrbitViewMode | null;Returns
OrbitViewMode | null
hideChildren()
hideChildren(ids): boolean;Hides the ideas under nodes, to show later (see OrbitSVGRenderer.hideChildren). Returns whether any were newly hidden.
Parameters
| Parameter | Type |
|---|---|
ids |
string | readonly string[] |
Returns
boolean
overview()
overview(): void;Flies out to the overview of the whole map.
Returns
void
revealChildren()
revealChildren(ids?): boolean;Shows ideas hidden under ids, or under every node (see OrbitSVGRenderer.revealChildren). Returns whether any were shown.
Parameters
| Parameter | Type |
|---|---|
ids? |
string | readonly string[] |
Returns
boolean
setViewMode()
setViewMode(mode): void;Parameters
| Parameter | Type |
|---|---|
mode |
OrbitViewMode |
Returns
void
spotlight()
spotlight(nodeId, options?): boolean;Brings a node up close, for something of your own to lie over it (see OrbitSVGRenderer.spotlight). Returns false when the view doesn’t draw it.
Parameters
| Parameter | Type |
|---|---|
nodeId |
string |
options? |
OrbitSpotlightOptions |
Returns
boolean
zoomBy()
zoomBy(factor): void;Zooms by factor around the middle of the map (above 1 zooms in).
Parameters
| Parameter | Type |
|---|---|
factor |
number |
Returns
void
Variables
OrbitMindMap
const OrbitMindMap: ForwardRefExoticComponent<OrbitMindMapProps & RefAttributes<OrbitMindMapRef>>;Renders an orbit map that fills its parent element, so give the parent a
size. Pass the map as source (markdown or YAML), document or data.
Callback props can be inline functions and theme / palette can be
inline objects: they never rebuild the map unless their values change.
Example
import { OrbitMindMap } from '@restless-dreams/orbit/react';
<div style={{ height: 480 }}>
<OrbitMindMap source={'# Launch\n## Research\n## Build'} theme="night" onFocusChange={(node) => console.log(node.text)} />
</div>