Skip to content

Expand

ESM:
Use dark colors for code blocksCopy
1
import "@arcgis/map-components/components/arcgis-expand";
CDN:
No specific import is needed for this component.
Since:ArcGIS Maps SDK for JavaScript 4.28

Expand acts as a clickable button for displaying interactive content, most commonly other components.

See also
Example
Use dark colors for code blocksCopy
1
2
3
4
5
<arcgis-map item-id="45b3b2fb35e94ab09381d0caa0da5946">
 <arcgis-expand slot="top-right">
  <arcgis-layer-list></arcgis-layer-list>
 </arcgis-expand>
</arcgis-map>

Demos

Expand with Custom ContentExpand with Component Content

The Expand component with custom content.

The Expand component with the Basemap Gallery component.

Properties

PropertyAttributeType
autoCollapseauto-collapseboolean
autoDestroyDisabledauto-destroy-disabledboolean
closeOnEscDisabledclose-on-esc-disabled(((event: KeyboardEvent) => boolean)) | boolean
collapseIcon
reflected
collapse-iconstring
collapseTooltipcollapse-tooltipstring
expanded
reflected
expandedboolean
expandIcon
reflected
expand-iconstring
expandTooltipexpand-tooltipstring
focusTrapDisabledfocus-trap-disabledboolean
focus-trap-enabledboolean
groupgroupstring
iconNumbericon-numbernumber
labellabelstring
messageOverridesRecord<string, unknown>
modemode"auto" | "drawer" | "floating"
placementplacement"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"
position
deprecated
position"bottom-leading" | "bottom-left" | "bottom-right" | "bottom-trailing" | "manual" | "top-leading" | "top-left" | "top-right" | "top-trailing"
referenceElementreference-elementHTMLArcgisLinkChartElement | HTMLArcgisMapElement | HTMLArcgisSceneElement | string
state
readonlyreflected
state"disabled" | "ready"
viewMapView | SceneView

autoCollapse

Property
autoCollapse: boolean

Automatically collapses the Expand component when the viewpoint updates.

Attribute
auto-collapse
Default value
false

autoDestroyDisabled

Property
autoDestroyDisabled: boolean

If 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

Property
closeOnEscDisabled: (((event: KeyboardEvent) => boolean)) | boolean
Since:ArcGIS Maps SDK for JavaScript 4.34Expand since 4.28, closeOnEscDisabled added at 4.34.

When 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
Use dark colors for code blocksCopy
1
2
3
<arcgis-expand slot="top-right" close-on-esc-disabled>
  <arcgis-search></arcgis-search>
</arcgis-expand>
Use dark colors for code blocksCopy
1
2
3
4
5
6
7
8
9
10
<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

reflected
Property
collapseIcon: string

Calcite icon used to style the Expand when it can be collapsed.

See also
Attribute
collapse-icon
Default value
"chevrons-right"

collapseTooltip

Property
collapseTooltip: string

Tooltip to display to indicate the Expand can be collapsed.

Attribute
collapse-tooltip
Default value
"Collapse" (English locale)

expanded

reflected
Property
expanded: boolean

Indicates whether the component is currently expanded or not.

Attribute
expanded
Default value
false

expandIcon

reflected
Property
expandIcon: string

Calcite 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

Property
expandTooltip: string

Tooltip to display to indicate Expand can be expanded.

Attribute
expand-tooltip
Default value
"Expand" (English locale)

focusTrapDisabled

Property
focusTrapDisabled: boolean

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-disabled
Default value
false

focusTrapEnabled

deprecatedProperty
focusTrapEnabled: boolean
Deprecatedsince 4.33, use focusTrapDisabled 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

Property
group: string

This 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
Use dark colors for code blocksCopy
1
2
3
4
5
6
7
8
<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

Property
iconNumber: number

A number to display at the corner of the component to indicate the number of, for example, open issues or unread notices.

expand component icon number

Attribute
icon-number
Default value
0

label

Property
label: string

The component's default label.

Attribute
label

messageOverrides

Property
messageOverrides: Record<string, unknown>
Since:ArcGIS Maps SDK for JavaScript 4.34Expand since 4.28, messageOverrides added at 4.34.

Replace localized message strings with your own strings.

Note: Individual message keys may change between releases.

mode

Property
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

Property
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

deprecatedProperty
position: "bottom-leading" | "bottom-left" | "bottom-right" | "bottom-trailing" | "manual" | "top-leading" | "top-left" | "top-right" | "top-trailing"
Deprecatedsince 4.34, use slot instead.
Attribute
position

referenceElement

Property

By 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.

See also
Attribute
reference-element

state

readonlyreflected
Property
state: "disabled" | "ready"
Since:ArcGIS Maps SDK for JavaScript 4.34Expand since 4.28, state added at 4.34.

The current state of the component.

Attribute
state
Default value
"disabled"

view

Property

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 view property 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 the view property.

Methods

MethodSignature
collapsecollapse(): Promise<void>
componentOnReadycomponentOnReady(): Promise<void>
destroydestroy(): Promise<void>
expandexpand(): Promise<void>

collapse

Method
collapse(): Promise<void>

Collapse the component.

Returns
Promise<void>

componentOnReady

Method
componentOnReady(): Promise<void>

Create a promise that resolves once component is fully loaded.

Example
Use dark colors for code blocksCopy
1
2
3
4
const arcgisExpand = document.querySelector("arcgis-expand");
document.body.append(arcgisExpand);
await arcgisExpand.componentOnReady();
console.log("arcgis-expand is ready to go!");
Returns
Promise<void>

destroy

Method
destroy(): Promise<void>

Permanently destroy the component.

Returns
Promise<void>

expand

Method
expand(): Promise<void>

Expand the component.

Returns
Promise<void>

Events

EventType
arcgisPropertyChangeCustomEvent<{ name: "expanded"; }>
arcgisReadyCustomEvent<void>

arcgisPropertyChange

Event
arcgisPropertyChange: CustomEvent<{ name: "expanded"; }>

Emitted when the value of a property is changed. Use this to listen to changes to properties.

bubbles
composed
cancelable

arcgisReady

Event
arcgisReady: CustomEvent<void>

Emitted when the component associated with a map or scene view is ready to be interacted with.

bubbles
composed
cancelable

Your browser is no longer supported. Please upgrade your browser for the best experience. See our browser deprecation post for more details.