Skip to main content

Styles

Here are the styles for the two components we have created.

styles.module.css
.accordion {
margin-bottom: 1.5rem;
}

.item {
border: 1px solid var(--ifm-color-emphasis-300);
border-top-width: 0;
}

.item:first-of-type {
border-top-width: 1px;
border-top-left-radius: 6px;
border-top-right-radius: 6px;
}

.item:last-of-type {
border-bottom-left-radius: 6px;
border-bottom-right-radius: 6px;
}

.item:first-of-type .button {
border-top-left-radius: 5px;
border-top-right-radius: 5px;
}

.item:last-of-type .button:not(.buttonExpanded) {
border-bottom-left-radius: 5px;
border-bottom-right-radius: 5px;
}

.button {
cursor: pointer;
display: flex;
align-items: center;
width: 100%;
margin: 0;
padding: 1rem 1.25rem;
font-size: 1rem;
font-weight: 400;
text-align: left;
color: var(--ifm-font-color-base);
background-color: transparent;
border: none;
transition: background-color 0.25s ease-in-out;
}

.buttonExpanded {
composes: button;
box-shadow: inset 0 -1px 0 0 var(--ifm-color-emphasis-300);
color: var(--ifm-color-primary);
background-color: var(--accordion-background);
}

.button:hover {
box-shadow: 0 0 0 1px var(--ifm-color-primary);
}

.button:disabled {
box-shadow: none;
cursor: auto;
color: #808080;
}

.button:focus {
position: relative;
outline: none;
}

.button:focus-visible {
box-shadow: 0 0 0 3px var(--ifm-color-primary);
}

@supports not selector(:focus-visible) {
.button:focus {
box-shadow: 0 0 0 3px var(--ifm-color-primary);
}
}

.chevron {
flex-shrink: 0;
margin-left: auto;
transition: transform 0.25s cubic-bezier(0, 0, 0, 1);
}

.buttonExpanded .chevron {
transform: rotate(180deg);
}

.content {
transition: height 0.25s cubic-bezier(0, 0, 0, 1);
}

.panel {
padding: 1rem 1.25rem;
}