Skip to main content

Padding

Written by Saifullah Bhatti
Updated yesterday

General Padding

You can add same padding to all sides of a tool by specifying one value in the container padding section. Here is the code snippet for the divider tool

unlayer.init({
tools: {
divider: {
properties: {
containerPadding: {
value: '10px',
},
},
},
},
});

Side Specific Padding

To add padding to a specific side, you can specify four values and the editor will add padding to that specific side. Here is a code snippet for text tool.

unlayer.init({   
tools: {
text: {
properties: {
containerPadding: {
editor: {
defaultValue: '0px 10px 0px 0px', // Top Right Bottom Left
},
},
},
},
},
});

You can also specify only two values and to generalize the padding for Top and Bottom, Left and Right. Here is the code snippet.

unlayer.init({   
tools: {
text: {
properties: {
containerPadding: {
editor: {
defaultValue: '10px 20px', // (Top Right),(Bottom Left)
},
},
},
},
},
});

This will add 10px padding to Top and Bottom and 20px padding to Left and Right.

Did this answer your question?