Skip to main content
The @tsdraw/react package includes a toolbar and style panel, configurable via uiOptions.

Toolbar

Hiding

<Tsdraw uiOptions={{ toolbar: { hide: true } }} />

Layout

The parts option controls grouping:
<Tsdraw uiOptions={{ toolbar: { parts: [['pen'], ['undo']] } }} />

Placement

Position relative to the edge:
<Tsdraw uiOptions={{ toolbar: { placement: { anchor: 'bottom-right' } } }} />

Draggable

<Tsdraw uiOptions={{ toolbar: { draggable: true, saveDraggedPosition: true } }} />

Pen mode indicator

When a stylus is detected, Pen mode is activated. This makes it easier for the user to draw using their pressure-sensitive display/stylus. The Pen control in the toolbar shows a small blue “P” badge during Pen mode. This is on by default. Hide it with:
<Tsdraw uiOptions={{ showPenModeIndicator: false }} />

Style panel

Click a bubble to open a context-style menu at the pointer with every choice together; the current value stays highlighted in the list.

Hiding

<Tsdraw uiOptions={{ stylePanel: { hide: true } }} />

Placement

<Tsdraw uiOptions={{ stylePanel: { placement: { anchor: 'top-right', edgeOffset: 18 } } }} />

Custom elements

Add arbitrary overlays:
<Tsdraw
  uiOptions={{
    customElements: [{
      id: 'logo',
      render: () => <div>tsdraw</div>
    }]
  }}
/>

Theming

<Tsdraw theme="light" /> // or "dark", "system"

Cursors

<Tsdraw uiOptions={{ cursor: { getCursor: (ctx) => 'crosshair' } }} />