New Research: Supply Chain Attack on Axios Pulls Malicious Dependency from npm.Details
Socket
Book a DemoSign in
Socket

quill-toolbar-tip

Package Overview
Dependencies
Maintainers
1
Versions
20
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

quill-toolbar-tip

a module for quill toolbar set tip text

latest
Source
npmnpm
Version
1.1.0
Version published
Maintainers
1
Created
Source

Quill Toolbar Tip

online demo

Install

npm install quill-toolbar-tip

Usage

If you want to use English text, you can use the default tip text that export named defaultToolbarTip

import QuillToolbarTip, { defaultToolbarTip } from 'quill-toolbar-tip';
import 'quill-toolbar-tip/dist/index.css';

Quill.register({
  [`modules/${QuillToolbarTip.moduleName}`]: QuillToolbarTip,
}, true);

const QuillToolbarTipOption = {
  tipTextMap: defaultToolbarTip['en-US']
};

const quill = new Quill('#editor', {
  theme: 'snow',
  modules: {
    toolbar: [
      ['bold', 'italic',],
      [{ list: 'ordered' }, { list: 'bullet' }],
      [{ script: 'sub' }, { script: 'super' }],
      [{ color: [] }, { background: [] }],
    ],
    [QuillToolbarTip.moduleName]: QuillToolbarTipOption
  },
});

Or you can add the text in tipTextMap to display in the tooltip. The keys match the toolbar format name.

import QuillToolbarTip from 'quill-toolbar-tip';
import 'quill-toolbar-tip/dist/index.css';

Quill.register({
  [`modules/${QuillToolbarTip.moduleName}`]: QuillToolbarTip,
}, true);

const QuillToolbarTipOption = {
  tipTextMap: {
    bold: 'Bold',
    italic: 'Italic',
    color: {
      onShow(target, value) {
        return `Font Color${value ? `: ${value}` : ''}`;
      },
    },
    background: {
      onShow(target, value) {
        return `Background Color${value ? `: ${value}` : ''}`;
      },
    },
  }
};

const quill = new Quill('#editor', {
  theme: 'snow',
  modules: {
    toolbar: [
      ['bold', 'italic',],
      [{ list: 'ordered' }, { list: 'bullet' }],
      [{ script: 'sub' }, { script: 'super' }],
      [{ color: [] }, { background: [] }],
    ],
    [QuillToolbarTip.moduleName]: QuillToolbarTipOption
  },
});

Configuration Structure

For toolbar formats with multiple values (like pickers and dropdowns), you can use the values object to map each value to its tooltip text:

const QuillToolbarTipOption = {
  tipTextMap: {
    list: {
      values: {
        ordered: 'Ordered List',
        bullet: 'Unordered List',
      },
    },
    align: {
      values: {
        '': 'Left aligned',
        'center': 'Center aligned',
        'right': 'Right aligned',
        'justify': 'Justify aligned',
      },
    },
  }
};

You can also use the onShow function to dynamically calculate the tooltip text. When both values and onShow are provided, onShow takes priority:

const QuillToolbarTipOption = {
  tipTextMap: {
    script: {
      values: {
        sub: 'Subscript',
        super: 'Superscript',
      },
      // onShow takes priority over values
      onShow(target, value) {
        return `Script: ${value}`;
      },
    },
  }
};

Options

OptionTypeDescription
defaultTooltipOptionsPartial<TooltipOptions>Default tooltip options.
tipTextMapRecord<string, Partial<TooltipItem> | string>Tooltip text map. You can also set a object that will be use in the tooltip. The configuration of tooltip options is shown below

Tooltip Options

OptionDescription
directionThe direction of the tooltip display
delayThe delay before the tooltip is displayed and hidden in milliseconds.
msgThe message of the tooltip
contentThe content of the tooltip
classNameThe class name of the tooltip
tipHoverableDisplay tooltip when tooltip is hovered. Default is true.
onShowCallback when tooltip show. If onShow return undefined, the tooltip will not be shown.
interface TooltipOptions {
  direction:
    | 'auto'
    | 'auto-start'
    | 'auto-end'
    | 'top'
    | 'top-start'
    | 'top-end'
    | 'bottom'
    | 'bottom-start'
    | 'bottom-end'
    | 'right'
    | 'right-start'
    | 'right-end'
    | 'left'
    | 'left-start'
    | 'left-end';
  msg: string;
  delay: number;
  content: HTMLElement;
  className: string | string[];
  onShow: (target: HTMLElement) => string | HTMLElement | undefined;
}

Only one of msg / content and onShow will be effective at the same time, with a priority of onShow > content > msg.

That means if you set a options like below. the final display text will be 'C'

const B = document.createElement('span');
B.textContent = 'B';

tipTextMap = {
  color: {
    msg: 'A',
    content: B,
    onShow() {
      return 'C';
    },
  },
};

The parameter value of onShow is the current value of the toolbar button or select

interface TooltipItem extends Omit<TooltipOptions, 'onShow'> {
  onShow: (target: HTMLElement, value: string) => string | HTMLElement;
}

The defaultTooltipOptions like below

const tooltipDefaultOptions = {
  msg: '',
  delay: 150,
  direction: 'top',
  className: [] as string[],
};

Keywords

quill

FAQs

Package last updated on 22 Mar 2026

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts