Tutorial: Layout.applyPreset

Layout.applyPreset

Replaces a Platform window's layout with a preset layout arrangement using the existing Views attached to the window. The preset options are columns, grid, rows, and tabs.

Example

let windowIdentity;
if (fin.me.isWindow) {
    windowIdentity = fin.me.identity;
} else if (fin.me.isView) {
    windowIdentity = (await fin.me.getCurrentWindow()).identity;
} else {
    throw new Error('Not running in a platform View or Window');
}

const layout = fin.Platform.Layout.wrapSync(windowIdentity);
await layout.applyPreset({ presetType: 'grid' });

// wait 5 seconds until you change the layout from grid to tabs
await new Promise (res => setTimeout(res, 5000));
await layout.applyPreset({ presetType: 'tabs' });