Skip to content
ESM
import "@arcgis/map-components/components/arcgis-expand";
Inheritance:
ArcgisExpandPublicLitElement
Since
ArcGIS Maps SDK for JavaScript 4.28

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

See also

Demos

Example
<arcgis-map item-id="45b3b2fb35e94ab09381d0caa0da5946">
<arcgis-expand slot="top-right">
<arcgis-layer-list></arcgis-layer-list>
</arcgis-expand>
</arcgis-map>

Properties

PropertyAttributeType
auto-collapse
auto-destroy-disabled
close-on-esc-disabled
boolean | ((event: KeyboardEvent) => boolean)
collapseIcon
reflected
collapse-icon
collapse-tooltip
expanded
reflected
expanded
expandIcon
reflected
expand-icon
expand-tooltip
focus-trap-disabled
group
icon-number
label
mode
"auto" | "drawer" | "floating"
placement
Panel["menuPlacement"] | undefined
reference-element
state
readonly
top-layer-disabled
visual-scale
Action["scale"]

autoCollapse

Property
Type
boolean

Automatically collapses the Expand component when the viewpoint updates.

Attribute
auto-collapse
Default value
false

autoDestroyDisabled

Property
Type
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
Type
boolean | ((event: KeyboardEvent) => boolean)
Since
ArcGIS Maps SDK for JavaScript 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.

Attribute
close-on-esc-disabled
Default value
false
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>

collapseIcon

autocast reflected Property
Type
IconName

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

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

collapseTooltip

Property
Type
string

Tooltip to display to indicate the Expand can be collapsed.

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

expanded

reflected Property
Type
boolean

Indicates whether the component is currently expanded or not.

Attribute
expanded
Default value
false

expandIcon

reflected Property
Type
IconName | null | undefined

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
Type
string

Tooltip to display to indicate Expand can be expanded.

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

focusTrapDisabled

Property
Type
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

group

Property
Type
string | undefined

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.

Attribute
group
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>

iconNumber

Property
Type
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
Type
string | undefined

The component's default label.

Attribute
label

messageOverrides

Property
Type
Record<string, unknown> | undefined
Since
ArcGIS Maps SDK for JavaScript 4.34

Replace localized message strings with your own strings.

Note: Individual message keys may change between releases.

mode

Property
Type
"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
Type
Panel["menuPlacement"] | undefined

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

referenceElement

Property
Type
ArcgisReferenceElement | string | undefined

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

readonly Property
Type
ExpandState
Since
ArcGIS Maps SDK for JavaScript 4.34

The current state of the component.

Default value
"disabled"

topLayerDisabled

Property
Type
boolean
Since
ArcGIS Maps SDK for JavaScript 5.0

When true, disables rendering in the top layer (above overlays and modals). This can be useful for controlling stacking context in complex UI layouts.

Attribute
top-layer-disabled
Default value
false

view

Property
Type
LinkChartView | MapView | SceneView | null | undefined

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 arcgis-expand component will be associated with a map or scene component rather than using the view property.

visualScale

Property
Type
Action["scale"]
Since
ArcGIS Maps SDK for JavaScript 5.0

Specifies the size of the component.

Attribute
visual-scale
Default value
"m"

Methods

MethodSignature
collapse(): Promise<void>
componentOnReady
inherited
componentOnReady(): Promise<this>
destroy(): Promise<void>
expand(): Promise<void>

collapse

Method
Signature
collapse (): Promise<void>

Collapse the component.

Returns
Promise<void>

componentOnReady

inherited Method
Signature
componentOnReady (): Promise<this>
Inherited from: PublicLitElement

Creates a promise that resolves once the component is fully loaded.

Returns
Promise<this>
Example
const arcgisExpand = document.querySelector("arcgis-expand");
document.body.append(arcgisExpand);
await arcgisExpand.componentOnReady();
console.log("arcgis-expand is ready to go!");

destroy

Method
Signature
destroy (): Promise<void>

Permanently destroy the component.

Returns
Promise<void>

expand

Method
Signature
expand (): Promise<void>

Expand the component.

Returns
Promise<void>

Events

NameType
CustomEvent<{ name: "expanded"; }>

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