Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add part selectors for better control of styling #10605

Closed
2 of 6 tasks
jasperwieringa opened this issue Oct 24, 2024 · 1 comment
Closed
2 of 6 tasks

Add part selectors for better control of styling #10605

jasperwieringa opened this issue Oct 24, 2024 · 1 comment
Labels
0 - new New issues that need assignment. calcite-components Issues specific to the @esri/calcite-components package. enhancement Issues tied to a new feature or request. impact - p1 - need for current milestone User set priority impact status of p1 - need for current milestone

Comments

@jasperwieringa
Copy link

Check existing issues

Description

We (from Alliander) need a way to update/access styling of elements within the ShadowRoot.
There are two ways of providing this within an open-source design-system:

  1. Ensuring that all components use css-variables that we can override on element level.
  2. Adding part selectors to the rendered elements, to allow full control over the styling (if required)

Acceptance Criteria

Every element that is not a slot, should contain part selectors, so the end-users can update the styling of these elements whenever they do not provide the support needed. With this new behaviour, users can change styling like flex-directions, paddings, margins etc. when these are not set through css variables.

Relevant Info

No dependencies and blockers.

Which Component

All components, since it is a low-effort, high-reward approach of making the components more user-friendly.

Example Use Case

<div>
 <div id="header" part="header">
  <slot name="header"></slot>
 </div>
 <div id="body" part="body">
  <slot></slot>
 </div>
 <div id="footer" part="footer">
  <slot name="footer"></slot>
 </div>
</div>

By adding this simple part to an element, a user can now style these specific parts through styling like so:

/** Internal styling of the component */
#header {
 display: flex;
 flex-direction: row;
}

/** Overriding the flex-direction by adding styling to the header part */
my-component::part(header) {
 flex-direction: column;
}

Priority impact

impact - p1 - need for current milestone

Calcite package

  • @esri/calcite-components
  • @esri/calcite-components-angular
  • @esri/calcite-components-react
  • @esri/calcite-design-tokens
  • @esri/eslint-plugin-calcite-components

Esri team

N/A

@jasperwieringa jasperwieringa added 0 - new New issues that need assignment. enhancement Issues tied to a new feature or request. needs triage Planning workflow - pending design/dev review. labels Oct 24, 2024
@github-actions github-actions bot added calcite-components Issues specific to the @esri/calcite-components package. impact - p1 - need for current milestone User set priority impact status of p1 - need for current milestone labels Oct 24, 2024
@macandcheese
Copy link
Contributor

At this time we do not plan to add support for part selectors (prior issue: #7353).

We are currently working through a large design token effort that should expose many other theming opportunities. This effort can be tracked here: #7180

@macandcheese macandcheese removed the needs triage Planning workflow - pending design/dev review. label Nov 18, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
0 - new New issues that need assignment. calcite-components Issues specific to the @esri/calcite-components package. enhancement Issues tied to a new feature or request. impact - p1 - need for current milestone User set priority impact status of p1 - need for current milestone
Projects
None yet
Development

No branches or pull requests

2 participants