calcite-design-system icon indicating copy to clipboard operation
calcite-design-system copied to clipboard

Expose CSS variable to style accordion item header in active state

Open rslibed opened this issue 3 years ago • 12 comments

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 avatar Feb 04 '22 00:02 rslibed

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.

macandcheese avatar Feb 04 '22 14:02 macandcheese

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 avatar Sep 21 '22 23:09 geospatialem

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?

geospatialem avatar Feb 22 '23 23:02 geospatialem

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.

macandcheese avatar Feb 23 '23 00:02 macandcheese

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

CharanGIS avatar Feb 23 '23 00:02 CharanGIS

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

geospatialem avatar Apr 17 '23 20:04 geospatialem

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.

ashetland avatar Jul 06 '23 21:07 ashetland

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

macandcheese avatar Jul 06 '23 21:07 macandcheese