Features Widget


This sample shows how to utilize the Features widget to allow the exploration of a feature's PopupTemplate content outside of the View. The Features widget should be used if needing to use the Popup functionality outside of the view.

The data used in this sample is from the National Park Service showing National Park boundaries alongside trails within each park. The popup content was preconfigured in an ArcGIS Online webmap and contains an Arcade element that returns text, a media element with charts, and a relationship element to display the related trails within each park.

How it works

Create a new instance of the Features widget and set its container to a div HTML element that resides in a Calcite Design System shell panel. Add a custom action that opens a web page to the FeaturesViewModel.actions property to display in the action bar under the title of the selected feature.

Use dark colors for code blocksCopy
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
        // Create a new instance of the Features widget and set
        // it's container to a div residing in a shell panel.
        const featuresWidget = new Features({
          container: "features-widget",
          viewModel: {
            // Add a custom action to the widget that will open a
            // website when it's selected.
            actions: [
              {
                type: "button",
                title: "Visitor Use Statistics",
                id: "more-info",
                icon: "information-letter"
              }
            ],
            view: view
          }
        });

Use reactiveUtils.on() to watch for the view click event and call Features.open() to display the widget with features residing in the click location.

Use dark colors for code blocksCopy
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
        // Open the Features widget with features fetched from
        // the view click event location.
        reactiveUtils.on(
          () => view,
          "click",
          (event) => {
            featuresWidget.open({
              location: event.mapPoint,
              fetchFeatures: true
            });
          }
        );

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