Skip to content

Name (key) parts of components #497

Open
@Malvoz

Description

@Malvoz

In line with Open UI's component spec template we should name parts of components using the HTML part attribute.

This would enable author- and user style sheets (requested in #297) via the CSS ::part() pseudo-element. And to some extent help us answer how styling MapML with CSS works.

Example

If we set part="reload-button" on the reload button, authors (and users/user style sheets) can now style the reload button:

<style>
  ::part(reload-button) {
    color: white;
    background-color: black;
  }

  /* I also briefly experimented with feature styling */
  ::part(feature) {
    fill: green;
    stroke: lime;
  }

  /* or scoped (`:defined` is optional): `mapml-viewer:defined::part(...) {}` */
</style>

<mapml-viewer ... controls>
  <layer- ...>
</mapml-viewer>

Notes

We should document any named parts as eligible for styling (related: Maps4HTML/web-map-doc#26).

References

Metadata

Metadata

Assignees

No one assigned

    Labels

    APIMap and associated elements' non-declarative API (events and methods)

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions