import "@arcgis/map-components/components/arcgis-expand";Expand acts as a clickable button for displaying interactive content, most commonly other components.
Example
<arcgis-map item-id="45b3b2fb35e94ab09381d0caa0da5946">
<arcgis-expand slot="top-right">
<arcgis-layer-list></arcgis-layer-list>
</arcgis-expand>
</arcgis-map>Demos
The Expand component with custom content.
The Expand component with the Basemap Gallery component.
Properties
| Property | Attribute | Type |
|---|---|---|
autoCollapse | auto-collapse | boolean |
autoDestroyDisabled | auto-destroy-disabled | boolean |
closeOnEscDisabled | close-on-esc-disabled | (((event: KeyboardEvent) => boolean)) | boolean |
collapseIconreflected | collapse-icon | string |
collapseTooltip | collapse-tooltip | string |
expandedreflected | expanded | boolean |
expandIconreflected | expand-icon | string |
expandTooltip | expand-tooltip | string |
focusTrapDisabled | focus-trap-disabled | boolean |
focusTrapEnableddeprecated | focus-trap-enabled | boolean |
group | group | string |
iconNumber | icon-number | number |
label | label | string |
messageOverrides | | Record<string, unknown> |
mode | mode | "auto" | "drawer" | "floating" |
placement | placement | "auto" | "auto-end" | "auto-start" | "bottom" | "bottom-end" | "bottom-start" | "leading" | "leading-end" | "leading-start" | "left" | "left-end" | "left-start" | "right" | "right-end" | "right-start" | "top" | "top-end" | "top-start" | "trailing" | "trailing-end" | "trailing-start" |
positiondeprecated | position | "bottom-leading" | "bottom-left" | "bottom-right" | "bottom-trailing" | "manual" | "top-leading" | "top-left" | "top-right" | "top-trailing" |
referenceElement | reference-element | HTMLArcgisLinkChartElement | HTMLArcgisMapElement | HTMLArcgisSceneElement | string |
statereadonlyreflected | state | "disabled" | "ready" |
view | | MapView | SceneView |
autoCollapse
autoCollapse: booleanAutomatically collapses the Expand component when the viewpoint updates.
- Attribute
- auto-collapse
- Default value
- false
autoDestroyDisabled
autoDestroyDisabled: booleanIf true, the component will not be destroyed automatically when it is disconnected from the document. This is useful when you want to move the component to a different place on the page, or temporarily hide it. If this is set, make sure to call the destroy method when you are done to prevent memory leaks.
- Attribute
- auto-destroy-disabled
- Default value
- false
closeOnEscDisabled
closeOnEscDisabled: (((event: KeyboardEvent) => boolean)) | booleanWhen true, the Expand component will not close itself if the Escape key is pressed while its content has keyboard focus.
This property can also be set to a function that returns a boolean, allowing for more customization for when to allow the
Expand component to be closed via the Escape key.
Examples
<arcgis-expand slot="top-right" close-on-esc-disabled>
<arcgis-search></arcgis-search>
</arcgis-expand><arcgis-expand slot="top-right">
<arcgis-search></arcgis-search>
</arcgis-expand>
<script>
const expandElement = document.querySelector("arcgis-expand");
const searchElement = document.querySelector("arcgis-search");
// don't close the expand if the search is active
expandElement.closeOnEscDisabled = () => searchElement.activeMenu !== "none";
</script>- Attribute
- close-on-esc-disabled
- Default value
- false
collapseIcon
collapseIcon: stringCalcite icon used to style the Expand when it can be collapsed.
- See also
- Attribute
- collapse-icon
- Default value
- "chevrons-right"
collapseTooltip
collapseTooltip: stringTooltip to display to indicate the Expand can be collapsed.
- Attribute
- collapse-tooltip
- Default value
- "Collapse" (English locale)
expanded
expanded: booleanIndicates whether the component is currently expanded or not.
- Attribute
- expanded
- Default value
- false
expandIcon
expandIcon: stringCalcite icon used to style the Expand when it can be expanded. The component will automatically use the icon of the component placed within the Expand if it has one.
- See also
- Attribute
- expand-icon
- Default value
- "chevrons-left"
expandTooltip
expandTooltip: stringTooltip to display to indicate Expand can be expanded.
- Attribute
- expand-tooltip
- Default value
- "Expand" (English locale)
focusTrapDisabled
focusTrapDisabled: booleanWhether the user's keyboard focus should be trapped in the expanded panel state. If true, tabbing
forward or backward will cycle through elements only within the panel content.
- Attribute
- focus-trap-disabled
- Default value
- false
focusTrapEnabled
focusTrapEnabled: booleanfocusTrapDisabled instead.Whether the user's keyboard focus should be trapped in the expanded panel state. If true, tabbing
forward or backward will cycle through elements only within the panel content.
- Attribute
- focus-trap-enabled
- Default value
- false
group
group: stringThis value associates two or more Expand components with each other, allowing one component to auto collapse when another in the same group is expanded. For auto collapsing to take effect, all components in the group must be included in the same Map, Scene, or Link Chart component.
For example, if you place multiple Expand components in the top-left slot of the Map, you can assign them to a
group called top-left. If one Expand component is expanded and the user clicks on a different component in the
top-left group, then the first component is collapsed, allowing the content of the second component to be
fully visible.
Example
<arcgis-map basemap="topo-vector">
<arcgis-expand slot="top-left" group="top-left" expanded>
<arcgis-layer-list></arcgis-layer-list>
</arcgis-expand>
<arcgis-expand slot="top-left" group="top-left">
<arcgis-basemap-gallery></arcgis-basemap-gallery>
</arcgis-expand>
</arcgis-map>- Attribute
- group
iconNumber
iconNumber: numberA number to display at the corner of the component to indicate the number of, for example, open issues or unread notices.
![]()
- Attribute
- icon-number
- Default value
- 0
messageOverrides
messageOverrides: Record<string, unknown>Replace localized message strings with your own strings.
Note: Individual message keys may change between releases.
mode
mode: "auto" | "drawer" | "floating"The mode in which the component displays. These modes are listed below:
auto: This is the default mode. It is responsive to browser size changes and will update based on whether the component is viewed in a desktop or mobile application.floating: Use this mode if you wish to always display the component as floating in a Calcite Popover component regardless of browser size.drawer: Use this mode if you wish to always display the component in a Calcite Sheet component regardless of browser size.
- Attribute
- mode
- Default value
- "auto"
placement
placement: "auto" | "auto-end" | "auto-start" | "bottom" | "bottom-end" | "bottom-start" | "leading" | "leading-end" | "leading-start" | "left" | "left-end" | "left-start" | "right" | "right-end" | "right-start" | "top" | "top-end" | "top-start" | "trailing" | "trailing-end" | "trailing-start"The placement used by the Calcite Popover when the component is expanded.
This property has no effect when the component is in drawer mode.
- Attribute
- placement
position
position: "bottom-leading" | "bottom-left" | "bottom-right" | "bottom-trailing" | "manual" | "top-leading" | "top-left" | "top-right" | "top-trailing"slot instead.- Attribute
- position
referenceElement
referenceElement: HTMLArcgisLinkChartElement | HTMLArcgisMapElement | HTMLArcgisSceneElement | stringBy assigning the id attribute of the Map or Scene component to this property, you can position a child component anywhere in the DOM while still maintaining a connection to the Map or Scene.
- Attribute
- reference-element
state
state: "disabled" | "ready"The current state of the component.
- Attribute
- state
- Default value
- "disabled"
view
The view associated with the component.
Note: The recommended approach is to fully migrate applications to use map and scene components and avoid using MapView and SceneView directly. However, if you are migrating a large application from widgets to components, you might prefer a more gradual transition. To support this use case, the SDK includes this
viewproperty which connects a component to a MapView or SceneView. Ultimately, once migration is complete, the Expand component will be associated with a map or scene component rather than using theviewproperty.
Methods
| Method | Signature |
|---|---|
collapse | collapse(): Promise<void> |
componentOnReady | componentOnReady(): Promise<void> |
destroy | destroy(): Promise<void> |
expand | expand(): Promise<void> |
componentOnReady
componentOnReady(): Promise<void>Create a promise that resolves once component is fully loaded.
Example
const arcgisExpand = document.querySelector("arcgis-expand");
document.body.append(arcgisExpand);
await arcgisExpand.componentOnReady();
console.log("arcgis-expand is ready to go!");- Returns
- Promise<void>
Events
| Event | Type |
|---|---|
arcgisPropertyChange | CustomEvent<{ name: "expanded"; }> |
arcgisReady | CustomEvent<void> |
arcgisPropertyChange
arcgisPropertyChange: CustomEvent<{ name: "expanded"; }>Emitted when the value of a property is changed. Use this to listen to changes to properties.
arcgisReady
arcgisReady: CustomEvent<void>Emitted when the component associated with a map or scene view is ready to be interacted with.