Configure Tools

Control which content tools appear in the editor, their order, and their default property values.

React
tsx


function CustomToolsEditor() {
  const editorRef = useRef<DragbleEditorRef>(null);

  return (
    <DragbleEditor
      ref={editorRef}
      editorKey="db_your_key"
      editorMode="email"
      options={{
        tools: {
          image: { enabled: true, position: 1 },
          heading: { enabled: true, position: 2 },
          text: { enabled: true, position: 3 },
          button: { enabled: true, position: 4 },
          divider: { enabled: true, position: 5 },
          // Disable tools you don't need
          video: { enabled: false },
          html: { enabled: false },
          timer: { enabled: false },
          form: { enabled: false },
        },
      }}
    />
  );
}
Vue
plaintext
<template>
  <DragbleEditor
    ref="editorRef"
    editor-key="db_your_key"
    editor-mode="email"
    :tools="{
      image: { enabled: true, position: 1 },
      heading: { enabled: true, position: 2 },
      text: { enabled: true, position: 3 },
      button: { enabled: true, position: 4 },
      divider: { enabled: true, position: 5 },
      video: { enabled: false },
      html: { enabled: false },
      timer: { enabled: false },
      form: { enabled: false },
    }"
  />
</template>

<script setup lang="ts">


const editorRef = ref<InstanceType<typeof DragbleEditor>>();
</script>
Angular
typescript



@Component({
  selector: "app-custom-tools",
  standalone: true,
  imports: [DragbleEditorComponent],
  template: `
    <dragble-editor
      #editor
      editorKey="db_your_key"
      editorMode="email"
      [tools]="toolsConfig"
    ></dragble-editor>
  `,
})
export class CustomToolsComponent {
  @ViewChild("editor") editorComp!: DragbleEditorComponent;

  toolsConfig: ToolsConfig = {
    image: { enabled: true, position: 1 },
    heading: { enabled: true, position: 2 },
    text: { enabled: true, position: 3 },
    button: { enabled: true, position: 4 },
    divider: { enabled: true, position: 5 },
    video: { enabled: false },
    html: { enabled: false },
    timer: { enabled: false },
    form: { enabled: false },
  };
}
Vanilla JS
typescript
dragble.init({
  containerId: "editor-container",
  editorKey: "db_your_key",
  editorMode: "email",
  options: {
    tools: {
      image: { enabled: true, position: 1 },
      heading: { enabled: true, position: 2 },
      text: { enabled: true, position: 3 },
      button: { enabled: true, position: 4 },
      divider: { enabled: true, position: 5 },
      video: { enabled: false },
      html: { enabled: false },
      timer: { enabled: false },
      form: { enabled: false },
    },
  },
});

You should see only the enabled tools in the side panel, ordered by their position value.

Built-in tools

All 14 built-in content tools:

ToolKeyDescription
ParagraphparagraphBody text block
TexttextRich text editor
HeadingheadingH1–H6 heading
ButtonbuttonCall-to-action button
ImageimageImage with alt text and link
DividerdividerHorizontal line separator
MenumenuNavigation menu links
HTMLhtmlRaw HTML code block
SocialsocialSocial media icon links
VideovideoEmbedded video
TabletableData table
TimertimerCountdown timer
FormformInput form fields
SpacerspacerVertical spacing block

Enable/disable tools

Set enabled: false to hide a tool from the side panel. Users cannot drag disabled tools onto the canvas:

typescript
tools: {
  html: { enabled: false },    // Hide the HTML tool
  form: { enabled: false },    // Hide the Form tool
  timer: { enabled: false },   // Hide the Timer tool
}

Tools not mentioned in the config remain enabled by default.

Reposition tools

Set the position property to control the display order. Lower numbers appear first:

typescript
tools: {
  button: { enabled: true, position: 1 },   // First
  image: { enabled: true, position: 2 },     // Second
  text: { enabled: true, position: 3 },      // Third
  heading: { enabled: true, position: 4 },   // Fourth
}

Override default property values

Set default values for tool properties. These apply when a user drags a new instance onto the canvas:

typescript
tools: {
  button: {
    enabled: true,
    properties: {
      text: { value: 'Get Started' },
      backgroundColor: { value: '#6366f1' },
      borderRadius: { value: '8px' },
    },
  },
  heading: {
    enabled: true,
    properties: {
      fontSize: { value: '28px' },
      fontWeight: { value: '700' },
    },
  },
  image: {
    enabled: true,
    properties: {
      altText: { editable: true },  // Ensure alt text is always editable
    },
  },
}

Lock a property

Set editable: false to prevent users from changing a property:

typescript
tools: {
  button: {
    properties: {
      // Users cannot change the border radius
      borderRadius: { value: '8px', editable: false },
    },
  },
}

Update tools at runtime

Call setToolsConfig() to change tool configuration without reinitializing the editor:

React
tsx
const disableHtml = () => {
  editorRef.current?.editor?.setToolsConfig({
    html: { enabled: false },
  });
};
Vue
typescript
function disableHtml() {
  editorRef.value?.setToolsConfig({
    html: { enabled: false },
  });
}
Angular
typescript
disableHtml() {
  this.sdk?.setToolsConfig({
    html: { enabled: false },
  });
}
Vanilla JS
typescript
dragble.setToolsConfig({
  html: { enabled: false },
});

ToolConfig type reference

typescript
interface ToolConfig {
  /** Show/hide the tool in the side panel */
  enabled?: boolean;
  /** Display order (lower = higher) */
  position?: number;
  /** Override default property values */
  properties?: Record<
    string,
    {
      value?: unknown;
      editable?: boolean;
    }
  >;
}

Method reference

MethodReturnsDescription
setToolsConfig(config)voidUpdate tool configuration at runtime

Next steps