Skip to content

Quill Options

This section explains how to configure the toolbar available Fields and the available fields using quill_options.

Customize Toolbar

You can customize the toolbar by creating one or many Groups. If you create many groups, they will be separated by a space in the toolbar.

Examples

Headers side by side:

php
QuillGroup::build(
    new HeaderField(HeaderField::HEADER_OPTION_1),
    new HeaderField(HeaderField::HEADER_OPTION_2),
)

Headers + Bold/Italic separated:

php
QuillGroup::build(
    new HeaderField(HeaderField::HEADER_OPTION_1),
    new HeaderField(HeaderField::HEADER_OPTION_2),
)
QuillGroup::build(
    new BoldField(),
    new ItalicField(),
)

Available Fields

Below is the list of available fields from QuillJS (https://v2.quilljs.com/docs/formats)

FieldDescriptionAvailable options (class constants)DefaultQuillJS name
BoldFieldmark text as bold-bold
ColorFieldChange color of the fontarray of colorscolor
BackGroundColorFieldchange background colorarray of colorsbackground
AlignFieldChoose text alignmentfalse (left), center, right, justifyallalign
DirectionFieldChoose text directionrtlrtldirection
FontFieldChoose a font''(sans serif) ,serif, monospaceallfont
HeaderGroupFieldList of header levels1, 2, 3, 4, 5, 6, falseallheader
HeaderFieldH1 or H2 widget only1, 21header
IndentFieldAdd or Remove indent+1, -1+1indent
ListFieldAdd a listordered, bullet, checkorderedlist
ScriptFieldSubscript/Superscriptsub, supersubscript
SizeFieldChange text sizesmall, false, large, hugeallsize
BlockQuoteFieldQuote a text-blockquote
CleanFieldClean text styling-clean
CodeBlockFieldAdd a code-block-code-block
CodeFieldAdd some code-code
FormulaFieldadd a formula (with Katex)-formula
ImageFieldAdd an image-image
ItalicFieldmark text as italic-italic
LinkFieldAdd a link-link
StrikeFieldmark text as striked-strike
UnderlineFieldmark text as underlined-underline
VideoFieldadd an embed video-video

Community Fields:

FieldDescription
EmojiFieldAdd an emoji
TableFieldAdd a table field

Exemple

php
use Ehyiah\QuillJsBundle\Form\QuillType;
use Ehyiah\QuillJsBundle\DTO\QuillGroup;
use Ehyiah\QuillJsBundle\DTO\Fields\BoldField;
use Ehyiah\QuillJsBundle\DTO\Fields\ItalicField;
use Ehyiah\QuillJsBundle\DTO\Fields\HeaderField;

public function buildForm(FormBuilderInterface $builder, array $options)
{
    $builder
        ->add('myField', QuillType::class, [
            'quill_options' => [
                QuillGroup::build(
                    new BoldField(),
                    new ItalicField(),
                ),
                QuillGroup::build(
                    new HeaderField(HeaderField::HEADER_OPTION_1),
                    new HeaderField(HeaderField::HEADER_OPTION_2),
                ),
                // Or add all built-in available fields at once
                QuillGroup::buildWithAllFields()
            ]
        ])
    ;
}