Skip to content

[discussion]: Should we prefix ::part names for components? #6679

Description

@gfellerph

In a discussion with @oliverschuerch, the question about prefixes for parts arose.

/* Unprefixed part, scoped by the element selector */
post-accordion,
post-accordion-item {
  &::part(button) {
    color: red;
  }
}

/* Prefixed part with our default prefix */
::part(post-accordion-button) {
  font-size: 20px;
}

If un-scoped parts are being used, e.g. ::part(button), it's way simpler to write and multiple button parts can be targeted at the same time, but we're risking that a global style for another button part is interfering with our own parts.

Currently, we're using parts on some web components with generic names. Re-naming them would be breaking changes.

Metadata

Metadata

Labels

No labels
No labels

Type

No type

Projects

Status
🚀 Done

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions