Skip to content

feat(layer-control): support collapsed groups and initial selection from layer visibility - #5

Open
PZahnen wants to merge 1 commit into
mainfrom
layer-control-initial-state
Open

PZahnen wants to merge 1 commit into
mainfrom
layer-control-initial-state

Conversation

@PZahnen

@PZahnen PZahnen commented Oct 2, 2026

Copy link
Copy Markdown
Collaborator

Requested by XLeitstelle: the LayerControl's initial state can now be controlled from the configuration and the style.

  • Groups can start collapsed: groups and radio-groups accept a new option opened (default true). With opened: false the group is collapsed when the map is loaded.
  • Initial selection follows the style: instead of activating every layer on load, the LayerControl now respects the visibility layout property of the style's layers (the same value that is toggled on click):
    • layers with "visibility": "none" start unchecked and stay hidden
    • groups start checked if all of their entries are checked
    • merge-groups start checked as soon as one of their layers is visible (they are switched as a whole)
    • radio-groups select their first entry that is not hidden (falling back to the first entry)

New Storybook stories Initial State and Initial State Interactions cover this.

Follow-up in ldproxy

After this is released (changeset: minor, 1.2.0):

  • bump @xtramaps/layer-control-maplibre and @xtramaps/layer-control-maplibre-react to ^1.2.0 in ogcapi-html
  • add the matching documentation, already prepared in the ldproxy branch layer-control-initial-state (commit "styles: document initial state of the layer control (opened, visibility)")

@PZahnen PZahnen self-assigned this Oct 2, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant