import type { BreakpointsOwner } from "@arcgis/core/views/BreakpointsOwner.js";- Since
- ArcGIS Maps SDK for JavaScript 4.0
A mixin that adds breakpoints, heightBreakpoint, orientation and widthBreakpoint properties to View2D and SceneView classes.
Properties
| Property | Type | Class |
|---|---|---|
| | ||
| | ||
orientation readonly | | |
| |
breakpoints
- Type
- Breakpoints
A convenience property used for defining the breakpoints on the height and width of the view. The sizes specified here determine the values of the widthBreakpoint and heightBreakpoint properties depending on the view's size.
Setting up breakpoints can aid in responsive app design. It does this
by watching width and height breakpoints. This is helpful as it removes
the need for multiple @media calls.
Instead of listening for the view's size and/or resizes property,
you can set up a watch handler for either the widthBreakpoint or
heightBreakpoint properties of the view.
Please refer to the styling guide for additional information on working with this.
Example
// Instead of watching the size or resizing propertiesreactiveUtils.watch(() => view.size, () => {});reactiveUtils.watch(() => view.resizing, () => {});
// Set up a watch handle for breakpointreactiveUtils.watch( () => view.widthBreakpoint, (breakpoint) => { switch (breakpoint) { case "xsmall": // do something break; case "small": case "medium": case "large": case "xlarge": // do something else break; default: } }); heightBreakpoint
- Type
- BreakpointSize
A convenience property indicating the general size of the view's height. This value is determined based on where the view's height falls in the ranges defined in the breakpoints property. See the table below for a list of possible values. Use the breakpoints property to override the default thresholds.
Please refer to the styling guide for additional information on working with this.
| Possible Value | Description | Default thresholds (pixels) |
|---|---|---|
| xsmall | The height of the view is smaller than the value set in the xsmall breakpoint. | < 545 |
| small | The height of the view is between the values set in the xsmall and small breakpoints. | 545 - 768 |
| medium | The height of the view is between the values set in the small and medium breakpoints. | 769 - 992 |
| large | The height of the view is between the values set in the medium and large breakpoints. | 993 - 1200 |
| xlarge | The height of the view is larger than the value set in the large breakpoint. | > 1200 |
Example
reactiveUtils.watch( () => view.heightBreakpoint === "xsmall", () => { // clear the view's default UI components if // the app is used on a mobile device view.ui.components = []; }); orientation
A convenience property indicating the view's orientation. See the table below for a list of possible values.
Please refer to the styling guide for additional information on working with this.
| Possible Value | Description |
|---|---|
| landscape | The width of the view is greater than its height. |
| portrait | The width of the view is equal to or smaller than its height. |
widthBreakpoint
- Type
- BreakpointSize
A convenience property indicating the general size of the view's width. This value is determined based on where the view's width falls in the ranges defined in the breakpoints property. See the table below for a list of possible values. Use the breakpoints property to override the default thresholds.
Please refer to the styling guide for additional information on working with this.
| Possible Value | Description | Default thresholds (pixels) |
|---|---|---|
| xsmall | The width of the view is smaller than the value set in the xsmall breakpoint. | < 545 |
| small | The width of the view is between the values set in the xsmall and small breakpoints. | 545 - 768 |
| medium | The width of the view is between the values set in the small and medium breakpoints. | 769 - 992 |
| large | The width of the view is between the values set in the medium and large breakpoints. | 993 - 1200 |
| xlarge | The width of the view is larger than the value set in the large breakpoint. | > 1200 |
Example
reactiveUtils.when( () => view.widthBreakpoint === "xsmall", () => { // clear the view's default UI components if // the app is used on a mobile device view.ui.components = []; });