Device Management

The editor supports content creation for multiple devices such as Mobile and Desktop out of the box. However, in some cases, you may want to restrict the editor to a mobile-only or desktop-only mode or keep mobile mode as the default mode.

Supported Devices

By default, the editor supports desktop and mobile devices. You can choose to disable one by removing it.

unlayer.init({
  devices: ['desktop', 'mobile'],
})

Default Device

When the editor is initialized, it opens in the default device mode that is selected here. You can choose to change the default mode to mobile mode if required.

unlayer.init({
  defaultDevice: 'desktop',
})

Mobile-Only Mode

If you want to run the editor in mobile-only mode, you can use the following code.

unlayer.init({
  defaultDevice: 'mobile',
  devices: ['mobile'],
})

Did this page help you?