---
title: Toolbar Module
---
The Toolbar module allow users to easily format Quill's contents.
It can be configured with a custom container and handlers.
```javascript
const quill = new Quill('#editor', {
modules: {
toolbar: {
container: '#toolbar', // Selector for toolbar container
handlers: {
bold: customBoldHandler
}
}
}
});
```
Because the `container` option is so common, a top level shorthand is also allowed.
```javascript
const quill = new Quill('#editor', {
modules: {
// Equivalent to { toolbar: { container: '#toolbar' }}
toolbar: '#toolbar'
}
});
```
## Container
Toolbar controls can either be specified by a simple array of format names or a custom HTML container.
To begin with the simpler array option:
```javascript
const toolbarOptions = ['bold', 'italic', 'underline', 'strike'];
const quill = new Quill('#editor', {
modules: {
toolbar: toolbarOptions
}
});
```
Controls can also be grouped by one level of nesting an array. This will wrap controls in a `` with class name `ql-formats`, providing structure for themes to utilize. For example [Snow](/docs/themes/#snow/) adds extra spacing between control groups.
```javascript
const toolbarOptions = [['bold', 'italic'], ['link', 'image']];
```
Buttons with custom values can be specified with an Object with the name of the format as its only key.
```javascript
const toolbarOptions = [{ header: '3' }];
```
Dropdowns are similarly specified by an Object, but with an array of possible values. CSS is used to control the visual labels for dropdown options.
```javascript
// Note false, not 'normal', is the correct value
// quill.format('size', false) removes the format,
// allowing default styling to work
const toolbarOptions = [
{ size: [ 'small', false, 'large', 'huge' ]}
];
```
Note [Themes](/docs/themes/) may also specify default values for dropdowns. For example, [Snow](/docs/themes/#snow/) provides a default list of 35 colors for the `color` and `background` formats, if set to an empty array.
```javascript
const toolbarOptions = [
['bold', 'italic', 'underline', 'strike'], // toggled buttons
['blockquote', 'code-block'],
[{ 'header': 1 }, { 'header': 2 }], // custom button values
[{ 'list': 'ordered'}, { 'list': 'bullet' }],
[{ 'script': 'sub'}, { 'script': 'super' }], // superscript/subscript
[{ 'indent': '-1'}, { 'indent': '+1' }], // outdent/indent
[{ 'direction': 'rtl' }], // text direction
[{ 'size': ['small', false, 'large', 'huge'] }], // custom dropdown
[{ 'header': [1, 2, 3, 4, 5, 6, false] }],
[{ 'color': [] }, { 'background': [] }], // dropdown with defaults from theme
[{ 'font': [] }],
[{ 'align': [] }],
['clean'] // remove formatting button
];
const quill = new Quill('#editor', {
modules: {
toolbar: toolbarOptions
},
theme: 'snow'
});
```
For use cases requiring even more customization, you can manually create a toolbar in HTML, and pass the DOM element or selector into Quill. The `ql-toolbar` class will be added to the toolbar container and Quill attach appropriate handlers to `