Skip to content

Commit aabdf46

Browse files
fix(accodian): add padding for nested accordians
1 parent 1605337 commit aabdf46

File tree

3 files changed

+14
-1
lines changed

3 files changed

+14
-1
lines changed

core/src/components/accordion/accordion.tsx

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -201,6 +201,12 @@ export class Accordion implements ComponentInterface {
201201
ionItem.lines = 'full';
202202
}
203203

204+
/**
205+
* Add a class to identify this item as an accordion header
206+
* for specific styling purposes
207+
*/
208+
ionItem.classList.add('accordion-header-item');
209+
204210
/**
205211
* Set the pressed state background color for ionic theme.
206212
* This overrides the default blue color from ion-item.

core/src/components/accordion/test/nested/index.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
<style>
1212
.grid {
1313
display: grid;
14-
grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
14+
grid-template-columns: repeat(auto-fill, minmax(350px, 1fr));
1515
grid-row-gap: 20px;
1616
grid-column-gap: 20px;
1717
}

core/src/components/item/item.ionic.scss

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -122,3 +122,10 @@ slot[name="end"]::slotted(*) {
122122
:host(.in-select-modal.ion-focused) .item-native {
123123
--border-radius: #{globals.$ion-border-radius-400};
124124
}
125+
126+
// Item in Accordion
127+
// --------------------------------------------------
128+
// Ensure button element in accordion header has proper horizontal padding
129+
:host(.accordion-header-item) .item-native {
130+
@include globals.padding-horizontal(globals.$ion-space-400);
131+
}

0 commit comments

Comments
 (0)