feat: extend ion-toast css shadow parts
See original GitHub issuePrequisites
- I have read the Contributing Guidelines.
- I agree to follow the Code of Conduct.
- I have searched for existing issues that already include this feature request, without success.
Describe the Feature Request
Extend ion-toast CSS shadow parts(https://ionicframework.com/docs/api/toast#css-shadow-parts) with content
so that html element with class “toast-content” can be stylized.
Describe the Use Case
.toast-content element would be stylizeable, which is not not an option. In our case, it helps with making message
part overflowing text displayed as ellipsis, but I could easily believe other users will find more uses to it.
Describe Preferred Solution
No response
Describe Alternatives
No response
Related Code
async showToastError(opts: ToastOptions): Promise<HTMLIonToastElement> {
opts.duration = 3000;
opts.color = 'danger';
this.addErrorDetailsButton(opts);
const toast = await this.toastController.create(opts);
await toast.present();
return toast;
}
private async addErrorDetailsButton(opts: ToastOptions): Promise<void> {
opts.cssClass = 'snap-error-toast';
const errorDetailsButton: ToastButton = {
side: 'end',
text: 'More details',
handler: () => this.presentModal(opts.message)
};
opts.buttons = [errorDetailsButton];
}
in scss file we have this part:
.snap-error-toast::part(message) {
text-overflow: ellipsis;
white-space: nowrap;
overflow: hidden;
}
in order for ellipsis to work as we need it to, min-width: 0
should be added to html element that currently contains ‘toast-content’ class.
Additional Information
Screenshots with results of the code above:
What is currently the case:
What we want to achieve:
Issue Analytics
- State:
- Created 2 years ago
- Comments:8 (3 by maintainers)
Top Results From Across the Web
CSS Shadow Parts - Ionic Framework
CSS Shadow Parts allow developers to style CSS properties on elements inside of a shadow tree. Read to learn more about customizing Ionic...
Read more >Styling in the Shadow DOM With CSS Shadow Parts
Styles can be applied using HTML element selectors like <button> and <div> . These styles could break a component. Shadow DOM is the...
Read more >Apply differents styles for buttons of ion-toast Component and ...
I´m creating an application with Ionic and i´m using the toast Component with two buttons. I have to create a different style for...
Read more >Increase Font Size Of Ion-Input Text - ADocLib
In this tutorial you will learn how to create HTML Text input box Set Height and Width [edit] BTW the examples are larger...
Read more >Customize your Ionic Framework app with CSS Shadow Parts!
Shadow parts make it easier to theme and customize Ionic Framework components. They replace the need for a large amount of CSS variables...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Sure! I will do it as soon as possible.
Thanks for the issue! This issue is being closed due to the lack of a reply. If this is still an issue with the latest version of Ionic, please create a new issue and ensure the template is fully filled out.
Thank you for using Ionic!