Socket
Socket
Sign inDemoInstall

@open-pioneer/basemap-switcher

Package Overview
Dependencies
267
Maintainers
4
Versions
7
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

    @open-pioneer/basemap-switcher

This package provides a UI component that allows a user to switch between different base maps.


Version published
Maintainers
4
Created

Readme

Source

@open-pioneer/basemap-switcher

This package provides a UI component that allows a user to switch between different base maps.

Unavailable basemaps are marked with an icon and will be deactivated for selection. If a basemap was configured as initially selected, it remains selected and there will not be any automatic fallback to another basemap.

Usage

To add the component to your app, insert the following snippet with a reference to a map ID:

<BasemapSwitcher mapId="map_id" />

To provide an option to deactivate all basemap layers, add the optional property allowSelectingEmptyBasemap (default: false).

<BasemapSwitcher mapId="map_id" allowSelectingEmptyBasemap />

Accessibility

The package provides only a HTMLSelectElement. To be compliant with a11y guidelines (screen reader compatibility), a label must be added to the basemap switcher. Therefore, use one of the following attempts:

  • Wrap the BasemapSwitcher into a Chakra UI FormControl and set the FormLabel to a custom label.
  • Use the aria-labelledby property of the BasemapSwitcher to specify that an anywhere defined label is used as the basemap switcher's label.
  • Use the aria-label property of the BasemapSwitcher to set an label for the screen reader that is not shown in the UI.

Example:

<FormControl>
    <FormLabel ps={1}>
        <Text as="b">{intl.formatMessage({ id: "basemapLabel" })}</Text>
    </FormLabel>
    <BasemapSwitcher mapId="map_id" allowSelectingEmptyBasemap></BasemapSwitcher>
</FormControl>

License

Apache-2.0 (see LICENSE file)

Keywords

FAQs

Last updated on 25 Mar 2024

Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc