interface OnLayoutOptions {
    aspectRatios?:
        | AspectRatioSpec
        | ("square" | "very-tall" | "tall" | "wide" | "very-wide")[];
    devices?: DeviceSpec | ("mobile" | "mobile-wide" | "tablet" | "desktop")[];
    skipInitial?: boolean;
}

Properties

aspectRatios?:
    | AspectRatioSpec
    | ("square" | "very-tall" | "tall" | "wide" | "very-wide")[]

Specifies a list of AspectRatios to target for.

The handler will only be called if there is a change of aspect ratio to an aspect ratios matching the specification.

It can be:

  • "min ": aspect ratios at least as wide as <AspectRatio>
  • "max ": aspect ratios at most as wide as <AspectRatio>
  • " to ": aspect ratios at least as wide as <AspectRatioMin> and at most as wide as <AspectRatioMax>
  • a comma-separated list of aspect ratio names
  • an array of aspect ratio names

NOTE

If only one of devices or aspectRatios is specified, the handler will only be called for matching changes of device or aspect ratio respectively.

If neither is specified, the handler will be called for any change of layout (device or aspect ratio).

undefined
devices?: DeviceSpec | ("mobile" | "mobile-wide" | "tablet" | "desktop")[]

Specifies a list of Devices to target for.

The handler will only be called if there is a change of device to a device matching the specification.

It can be:

  • "min ": devices at least as wide as <Device>
  • "max ": devices at most as wide as <Device>
  • " to ": devices at least as wide as <DeviceMin> and at most as wide as <DeviceMax>
  • a comma-separated list of device names
  • an array of device names

NOTE

If only one of devices or aspectRatios is specified, the handler will only be called for matching changes of device or aspect ratio respectively.

If neither is specified, the handler will be called for any change of layout (device or aspect ratio).

Also note that an empty array is treated the same as not given, or null.

undefined
skipInitial?: boolean

Do not call the handler until there's a future change of layout.

By default, we call the handler (almost) immediately with the current layout data if it matches the given devices and aspectRatios.

false