8.1 Implementing SDK Widgets

8.1 Implementing API Widgets

Esri provides several widgets that can be added to the GUI with little coding to improve the user experience. A common use for widgets is in enabling the user to change basemaps. The BasemapToggle widget is used when you have exactly two basemaps that you’d like the user to be able to switch between. The BasemapGallery widget allows the user to choose from any number of basemap options. Let’s have a look at how these and a few other widgets are implemented.

Note: You'll see that some of the widgets discussed here, such as the BasemapToggle, have been deprecated. This means that their use will still be supported for a short time, but you are encouraged to implement the functionality in a newer way. Esri is in the process of phasing out of all of its widgets in favor of web components. We'll talk more about web components, including how to implement a BasemapToggle using one, later in the lesson. We still cover the older widgets here because a) not all of them have a web component replacement yet, and b) you're likely to see widgets used in other people's apps. For all deprecated widgets, which we'll note, you should read over the discussion in this section as an FYI. For Assignment 8 and any other apps you develop going forward, you should be using the web components discussed in the next section whenever possible.