-
Notifications
You must be signed in to change notification settings - Fork 13.5k
Ionic v2 ActionSheet: custom icon or image #6589
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
Hello @ryanlin1986 ! Im sorry, but im not sure i understand exactly what the issue is. Are you wanting to put a button inside another button? Thanks for using Ionic! |
Sorry, I have updated my question, something is hidden. |
Hey @ryanlin1986 . You can definitely use icons in our buttons. Can you try this for me?
|
I mean the button item of action sheet. |
Hey @ryanlin1986 it should work the same way on an action sheet (: Would you mind making a plunker that demonstrates your issue? |
Hello all! As it seems it has been a while since there was any activity on this issue i will be closing it for now. Feel free to comment if you are still running into this issue. Thanks for using Ionic! |
Is there any way to add a custom image to an action sheet button? The action sheet component supports buttons, but it seems that only their text can be set, i.e.: let actionSheet = this.actionSheetController.create({
title: 'Test',
buttons: [
{
text: 'Destructive'
}]
}); |
@ryanlin1986 I finally found out how to do it, you can add the icon using the let actionSheet = this.actionSheetController.create({
title: 'Test',
buttons: [
{
text: 'Test 1',
icon: 'check'
},
{
text: 'Test 2',
icon: 'close'
}]
}); Reference: ionic-team/ionic-preview-app@3fa3c62 |
I want use font awesome instead ionic icon, no way to do this for now, |
I agree, it would be great to add your own template code to the actionsheet.
|
Actually is easier than it looks, this is an example with whatsapp icon, just add this to your app.scss: .ion-md-whatsapp:before, .ion-ios-whatsapp:before{ |
Hi! I'm using actionsheets on my project and it's working great! But I want to use custom icons (instead of ionicons) in my actionsheet's options, for example:
Sorry for my bad codem and thanks! |
Does anyone have a work around for this yet? I am looking to add custom icons to the buttons. |
Not yet as I know, my solution is write my own action sheet control instead of use ionic's built-in. |
I use my own icons in my app and don't even include the ionicons set. To get the Ionic action sheets to show my icons, I just
let actionSheet = this.actionCtrl.create({
buttons: [
{
text: 'Edit',
icon: 'edit',
handler: () => {
this.openEditPage();
}
},
...
IonicModule.forRoot(MyApp, { mode: 'md', ...
.ion-md-edit {
// Eventually, this may work...
//background: url('/assets/icon/icons.svg#icon-edit') 50% 50% no-repeat;
background: url('data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0...wvcGF0aD48L3N2Zz4=') 50% 50% no-repeat;
} I used to use this same trick for tab icons, but I no longer use tabs and am not sure if there is a better way now. Also, this would work for non-md, too, you just have to override the correct class based on which mode you are in. EDIT: I was showing BASE64 versions of SVG icons. You can do font-based or whatever you want. I'm moving from BASE64 to URL-encoded SVG. https://css-tricks.com/probably-dont-base64-svg/ |
Thanks for the issue! This issue is being locked to prevent comments that are not relevant to the original issue. 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. |
Uh oh!
There was an error while loading. Please reload this page.
In v2, the button text can not support html, such as <i class="fa fa-user"></i>test button.
It worked in v1, is there any plan to support this?
The text was updated successfully, but these errors were encountered: