-
Notifications
You must be signed in to change notification settings - Fork 76
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
Expose CSS variable to style accordion item header in active state #4060
Comments
Thoughts @asangma ? Before adding something like this I’d like to try making the active accordion item more obvious by default than providing this variable, we run into issues here as some accordion appearance types has no x-padding on the header. |
This also came up in a Community post on 9/21/2022 to modify the header color. As mentioned in the description above the background can be changed. Additionally, a customized border and icon color (if present) can be accessed, but not the header or description text color. A Codepen example for context: https://codepen.io/geospatialem/pen/dyezJQN |
While not related to Perhaps a pattern we could consider across components with |
Still not sure we need to allow for this level of customization. The accordion example at least has a correlation to open state. The community post is invalidly nesting blocks and asking to make some headings bold. I don’t think that is a pattern we should document or recommend. |
Hi, would it be better to have calcite-blocks within calcite-accordion-item similar to his example |
Will revisit once tokens have been implemented to determine next feasible steps. |
Agree with the above that the requested level of customization may not be advisable — Accordion Items can't be selected, only expanded or collapsed. It may be worth looking at some padding tweaks to make the expanded state more clear. See Carbon's Accordion as an example. |
Agree - tokens would allow this level of customization as well depending on granularity of token exposed per component. |
+1 from another Esri Community member on 8/26/2024 |
Yeah that case makes sense - ideally these would just be |
Per Aaron's comment, #4060 (comment) |
I think we should still expose the props. If a user decides to base those styling decisions on the open state, that’s up to them. We can document defensively about that as we should with all these component specific props, but not having accordion-item properties to achieve the Community post example where all of the items are themed, does seem like a missing story, IMO. |
**Related Issue:** #7180 #4060 ## Summary While this does not create additional tokens for the background color in a -hover or -press state explicitly because this is outside of our current design patterns, it does allow a user to accomplish this by only targeting the top-level component styles. ```css calcite-accordion-item:hover { --calcite-accordion-item-background-color: blue; } calcite-accordion-item[expanded] { --calcite-accordion-item-header-background-color: blue; } ``` ### Tokens --calcite-accordion-item-background-color: Specifies the component's background color. --calcite-accordion-item-border-color: Specifies the component's border color. --calcite-accordion-item-content-space: Specifies the component's padding. --calcite-accordion-item-header-background-color: Specifies the background color of the component's header. --calcite-accordion-item-text-color: Specifies the component's text color. --calcite-accordion-item-heading-text-color: Specifies the component's heading text color. --calcite-accordion-item-icon-color: Specifies the component's default icon color. --calcite-accordion-item-start-icon-color: Specifies the component's start icon color. Fallback to --calcite-accordion-item-icon-color or current color. --calcite-accordion-item-end-icon-color: Specifies the component's end icon color. Fallback to --calcite-accordion-item-icon-color or current color. --calcite-accordion-item-expand-icon-color: Specifies the component's expand icon color. ### Deprecated --calcite-accordion-border-color: Use --calcite-accordion-item-border-color. Specifies the component's border color. --calcite-accordion-text-color-hover: Use --calcite-accordion-item-text-color-hover. Specifies the component's main text color on hover. --calcite-accordion-text-color-pressed: Use --calcite-accordion-item-text-color-press. Specifies the component's main text color when pressed. --calcite-accordion-text-color: Use --calcite-accordion-item-text-color. Specifies the component's text color.
Installed and assigned for verification. |
Verified in |
Description
When an accordion item is selected within an accordion, provide a css variable to configure the color of just the accordion item header to more obviously indicate that it is selected.
There appears to be
--calcite-accordion-item-background
but that seems to color the entire accordion background (header and contents).Acceptance Criteria
Relevant Info
No response
Which Component
calcite-accordion-item
Example Use Case
No response
The text was updated successfully, but these errors were encountered: