Days
Hours
Minutes
Seconds
x

New Froala Editor v5.0.0 is here โ€“ Learn More

Skip to content

Custom Elements

Bottom Toolbar Button

Below is the basic JS for creating a custom button for the bottom page toolbar.

// Define page edit button.
FroalaPages.Button.Register('myPageButton', {
title: 'My Page Button',
icon: {
type: 'svg',
template: '<svg viewBox="0 0 24 24" xmlns="http://www.w3.org/2000/svg"><path d="M3 17.25V21h3.75L17.81 9.94l-3.75-3.75L3 17.25zM20.71 7.04c.39-.39.39-1.02 0-1.41l-2.34-2.34c-.39-.39-1.02-.39-1.41 0l-1.83 1.83 3.75 3.75 1.83-1.83z"/><path d="M0 0h24v24H0z" fill="none"/></svg>'
},
callback() {
// Wave the world.
alert('Hello World!');

// Show current page instance.
console.log(this.page);
},
refresh() {
// Change the state of the button.
this.el.classList.toggle('fp-active', true);
}
})

Note: Once a command is defined it can be included in the buttons options: pageLeftButtons, pageCenterButtons or pageRightButtons.

Sign up

Download the code by signing up for our newsletter

Sign up

Download the code by signing up for our newsletter

Note: By registering, you confirm that you agree to the processing of your personal data by Froala, Inc. - Froala as described in the Privacy Statement. Froala, Inc. - Froala is part of the Idera group and may share your information with its parent company Idera, Inc., and its affiliates. For further details on how your data is used, stored, and shared, please review our Privacy Statement.