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

Expose CSS variable to style accordion item header in active state #4060

Closed
Tracked by #7180
rslibed opened this issue Feb 4, 2022 · 14 comments
Closed
Tracked by #7180

Expose CSS variable to style accordion item header in active state #4060

rslibed opened this issue Feb 4, 2022 · 14 comments
Assignees
Labels
4 - verified Issues that have been released and confirmed resolved. design Issues that need design consultation prior to development. design-tokens Issues requiring design tokens. enhancement Issues tied to a new feature or request. p - medium Issue is non core or affecting less that 60% of people using the library

Comments

@rslibed
Copy link

rslibed commented Feb 4, 2022

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

image

Relevant Info

No response

Which Component

calcite-accordion-item

Example Use Case

No response

@rslibed rslibed 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 Feb 4, 2022
@macandcheese
Copy link
Contributor

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.

@benelan benelan added the design Issues that need design consultation prior to development. label Jun 29, 2022
@geospatialem
Copy link
Member

geospatialem commented Sep 21, 2022

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

@geospatialem
Copy link
Member

While not related to accordion-item, a similar question was asked on Community on 2/22/2023 related to block headings.

Perhaps a pattern we could consider across components with heading attributes?

@macandcheese
Copy link
Contributor

macandcheese commented Feb 23, 2023

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.

@CharanGIS
Copy link

CharanGIS commented Feb 23, 2023

Hi, would it be better to have calcite-blocks within calcite-accordion-item similar to his example

@geospatialem geospatialem added the blocked This issue is blocked by another issue. label Apr 17, 2023
@geospatialem geospatialem added this to the Stalled milestone Apr 17, 2023
@geospatialem
Copy link
Member

Will revisit once tokens have been implemented to determine next feasible steps.

@ashetland ashetland added the p - low Issue is non core or affecting less that 10% of people using the library label Jul 6, 2023
@ashetland ashetland modified the milestones: Stalled , Design Backlog Jul 6, 2023
@ashetland ashetland removed the needs triage Planning workflow - pending design/dev review. label Jul 6, 2023
@ashetland
Copy link

ashetland commented Jul 6, 2023

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.

@macandcheese
Copy link
Contributor

Agree - tokens would allow this level of customization as well depending on granularity of token exposed per component.

@brittneytewks brittneytewks added the figma changes Issues that require additions or updates to the Figma UI Kit where no `design` label exists label Sep 12, 2023
@brittneytewks brittneytewks removed the figma changes Issues that require additions or updates to the Figma UI Kit where no `design` label exists label Dec 11, 2023
@geospatialem geospatialem added the design-tokens Issues requiring design tokens. label Dec 21, 2023
@geospatialem
Copy link
Member

+1 from another Esri Community member on 8/26/2024

@macandcheese
Copy link
Contributor

Yeah that case makes sense - ideally these would just be --calcite-accordion-item-x properties with heading, description, icon, background-color, etc. - then users can style as they wish based on :hover, [selected], etc., as they need.

@alisonailea
Copy link
Contributor

Per Aaron's comment, #4060 (comment)
we don't want to break existing design patterns, is there another solution here?

@macandcheese
Copy link
Contributor

macandcheese commented Aug 28, 2024

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.

alisonailea added a commit that referenced this issue Sep 13, 2024
**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.
@geospatialem geospatialem removed blocked This issue is blocked by another issue. 0 - new New issues that need assignment. labels Sep 13, 2024
@geospatialem geospatialem added the 3 - installed Issues that have been merged to master branch and are ready for final confirmation. label Sep 13, 2024
Copy link
Contributor

Installed and assigned for verification.

@geospatialem geospatialem added p - medium Issue is non core or affecting less that 60% of people using the library 4 - verified Issues that have been released and confirmed resolved. and removed p - low Issue is non core or affecting less that 10% of people using the library 3 - installed Issues that have been merged to master branch and are ready for final confirmation. labels Sep 16, 2024
@geospatialem
Copy link
Member

Verified in 2.13.0-next.14 with https://codepen.io/geospatialem/pen/RwzzPNE for expanded and the :hover states:

image

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
4 - verified Issues that have been released and confirmed resolved. design Issues that need design consultation prior to development. design-tokens Issues requiring design tokens. enhancement Issues tied to a new feature or request. p - medium Issue is non core or affecting less that 60% of people using the library
Projects
None yet
Development

No branches or pull requests

9 participants