Configuration

Control how your SketchAPI instance looks, behaves, and what tools are available — all through the Sketchpad config object.

For the full TypeScript schema, see the App Config Reference.

Table of Contents


Canvas

Set the rendering mode and default drawing styles:

const sketchpad = new Sketchpad({
  canvas: {
    renderMode: 'svg',
    allowTemplateEditing: false,
    defaultStyles: {
      strokeColor: '#333',
      fillColor: 'transparent',
      strokeWidth: 2
    }
  }
})
PropertyTypeDescription
renderMode'svg' \| 'vector' \| 'bitmap'Rendering engine mode
allowTemplateEditingbooleanWhether users can modify template layers
defaultStyles.strokeColorstringDefault stroke color for new objects
defaultStyles.fillColorstringDefault fill color for new objects
defaultStyles.strokeWidthnumberDefault stroke width for new objects

Settings

Workspace behavior, history, autosave, and language:

settings: {
  language: 'en',
  autosave: 5,
  restoreSettings: true,
  history: {
    canUndo: true,
    canRedo: true,
    limit: -1,
    groupBy: 'operation'
  }
}
PropertyTypeDescription
languagestringInterface language code
autosavenumberAutosave interval in minutes (-1 = disabled, 0 = immediate)
restoreSettingsbooleanRestore previous session settings on load
history.canUndobooleanEnable undo
history.canRedobooleanEnable redo
history.limitnumberMax history steps (-1 = unlimited)
history.groupBy'operation' \| 'save'Group history by individual operations or saves

Theme

Customize the interface colors:

settings: {
  theme: {
    background: '#302e40',
    foreground: '#ffffff',
    accent: '#ff0000'
  }
}

Hotkeys

Map keyboard shortcuts to tools and actions:

settings: {
  hotkeys: {
    'cmd+z': 'undo',
    'cmd+s': 'save',
    'c': 'circle',
    'r': 'rectangle',
    't': 'text',
    'delete': 'delete',
    'escape': 'deselect'
  }
}

UI Panels

Enable, disable, and customize the three main UI panels. See Components for the full list of panel components.

ui: {
  PrimaryToolbar: {
    enabled: true,
    mirrorInRTL: true,
    position: 'left',
    primaryCommands: ['select', 'move', 'rotate', 'resize', 'attach', 'delete'],
    secondaryCommands: ['newDocument', 'openDocument', 'exportDocument', 'settings']
  },
  ExportPane: {
    enabled: true,
    components: [
      'DownloadPaneTrigger',
      'DownloadRegion',
      { type: 'QuickDownload', formats: ['JPEG', 'PNG', 'PDF', 'SVG', 'SKETCHPAD'] },
      'PrintPaneTrigger'
    ]
  },
  SettingsPane: { enabled: true },
  WelcomeMessage: { enabled: false },
  EmbeddedWatermark: { enabled: false }
}

Export Defaults

Set default export format and quality in the document settings:

settings: {
  exportDPI: 72,
  exportFormat: 'png',
  exportQuality: 0.95
}
PropertyTypeDescription
exportDPInumberOutput resolution in dots per inch
exportFormatstringDefault format (png, jpg, svg)
exportQualitynumberQuality from 0 to 1 (for lossy formats)