ionic-team / ionic-framework

A powerful cross-platform UI toolkit for building native-quality iOS, Android, and Progressive Web Apps with HTML, CSS, and JavaScript.
https://ionicframework.com
MIT License
51.09k stars 13.51k forks source link

feat: toolbar, access toolbar background element via css #26595

Open samuelrebuelta opened 1 year ago

samuelrebuelta commented 1 year ago

Prerequisites

Describe the Feature Request

I need to apply a transition on the background of ion-toolbar, and there is currently no way to access the toolbar-background class.

image

Describe the Use Case

be able to apply styles as transitions in the background-color

Describe Preferred Solution

Adding a shadow part.

Describe Alternatives

No response

Related Code

No response

Additional Information

No response

zolakt commented 1 month ago

Does anyone have a workaround for this? The only one I've found is this:

ion-toolbar {
    --background: none;
    background: red;
    transition: background 2s;
}

ion-toolbar:hover {
    background: green;
}

However, that it is not a good one. With this, when you transition to another page, the header color remains visible until the transition is complete. Apart from using this in combination with some crazy JS what would make this change only before animation, and remove it as soon as it's done, I haven't seen any other workarounds