Skip to main content

UIOptions

The UIOptions prop allows you to customize which UI features and canvas actions are available in the Excalidraw editor.

Type Definition

Properties

number
The viewport width (in pixels) below which the sidebar switches from docked to floating mode.Allows you to control responsive behavior of the sidebar.
CanvasActions
Configuration object controlling which canvas actions are available.See Canvas Actions below for details.
object
Configuration for tool availability.
function
Optional function to control the editor form factor and desktop UI mode from the host app.If not provided, Excalidraw determines this automatically based on viewport size.

Canvas Actions

The canvasActions object controls which actions are available in the canvas menu and UI.

Action Properties

boolean
default:"true"
When false, hides the canvas background color picker.
boolean
default:"true"
When false, hides the “Clear canvas” action.
false | ExportOpts
default:"{ saveFileToDisk: true }"
Controls export functionality.
  • false: Disables all export features
  • ExportOpts: Configures export behavior (see Export Options)
boolean
default:"true"
When false, hides the “Load scene” action (open file functionality).
boolean
default:"true"
When false, hides the “Save to active file” action.
boolean | null
default:"null"
Controls the theme toggle button.
  • true: Shows the theme toggle
  • false: Hides the theme toggle
  • null: Default behavior (shows based on context)
boolean
default:"true"
When false, hides the “Save as image” action.

Export Options

When canvasActions.export is an object, you can configure export behavior:
boolean
default:"true"
When false, disables the ability to save exports directly to disk.
function
Custom handler for backend export. Called when user exports the canvas.
function
Custom UI renderer for the export dialog.

Default Values

Excalidraw uses these default values when UIOptions is not provided:

Usage Examples

Minimal UI

Disable most UI actions for a read-only or embedded experience:

Custom Export Only

Enable custom backend export while disabling file downloads:

Show Theme Toggle

Explicitly enable the theme toggle:

Custom Form Factor Logic

Control when mobile vs desktop UI is used:

Type Imports