Preview Designs
This feature allows end-users to toggle between viewing their design in mobile, tablet or desktop mode, ensuring responsiveness and compatibility across different devices. It also allows end-users to view their emails in different email clients to ensure email client compatibility. This feature can be controlled programmatically, hidden, or customized to show dynamic content through custom HTML.
Enable or Disable
By default, the preview icon is visible in the actions bar, but you can choose to hide it using the unlayer.init() configuration.
Example:
unlayer.init({
features: {
preview: false, // Disable mobile/desktop preview icons
},
});
Setting preview: false will hide the preview toggle icons in the editor’s actions bar.
Programmatically Controlling Preview Mode
You can also show or hide the preview mode programmatically, allowing developers to control when the preview is shown and which device mode (mobile or desktop) is active.