Skip to content

Commit 0807e6b

Browse files
feat(item): add styles for pressed state in ionic theme (#29586)
Issue number: internal --------- ## What is the new behavior? - Added scss for the pressed state of `ion-item` for the Ionic theme - Added item with class `ion-activatable` ([according to docs](https://github.com/ionic-team/ionic-framework/blob/main/docs/component-guide.md#activated)) to test page ## Does this introduce a breaking change? - [ ] Yes - [x] No --------- Co-authored-by: Bernardo Cardoso <[email protected]>
1 parent 14d3500 commit 0807e6b

File tree

3 files changed

+20
-0
lines changed

3 files changed

+20
-0
lines changed

core/api.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -985,6 +985,7 @@ ion-item,prop,type,"button" | "reset" | "submit",'button',false,false
985985
ion-item,css-prop,--background,ionic
986986
ion-item,css-prop,--background,ios
987987
ion-item,css-prop,--background,md
988+
ion-item,css-prop,--background-activated,ionic
988989
ion-item,css-prop,--background-activated,ios
989990
ion-item,css-prop,--background-activated,md
990991
ion-item,css-prop,--background-activated-opacity,ios

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

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66
:host {
77
/**
88
* @prop --background: Background of the item
9+
* @prop --background-activated: Background of the item when pressed. Note: setting this will interfere with the Material Design ripple.
910
*
1011
* @prop --border-color: Color of the item border
1112
* @prop --border-style: Style of the item border
@@ -20,6 +21,7 @@
2021
*
2122
*/
2223
--background: #{globals.$ionic-color-base-white};
24+
--background-activated: #{globals.$ionic-color-neutral-200};
2325
--border-color: #{globals.$ionic-color-neutral-300};
2426
--border-style: #{globals.$ionic-border-style-solid};
2527
--border-width: #{globals.$ionic-border-size-025};
@@ -88,3 +90,10 @@
8890
box-sizing: border-box;
8991
}
9092
}
93+
94+
// Item: Activated
95+
// --------------------------------------------------
96+
97+
:host(.ion-activated) .item-native {
98+
background: var(--background-activated);
99+
}

core/src/components/item/test/theme-ionic/index.html

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -158,6 +158,16 @@ <h1>Heading</h1>
158158
</ion-label>
159159
<ion-button slot="end" fill="outline">Outline</ion-button>
160160
</ion-item>
161+
<ion-item-divider>
162+
<ion-label>Item activatable</ion-label>
163+
</ion-item-divider>
164+
<ion-item class="ion-activatable">
165+
<ion-label slot="start">Start</ion-label>
166+
<ion-label>
167+
<h1>Heading</h1>
168+
<p>Normal paragraph</p>
169+
</ion-label>
170+
</ion-item>
161171
</ion-content>
162172

163173
<ion-footer>

0 commit comments

Comments
 (0)