Skip to content
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

ionic2 - enhancement(modal) - add cssClass property to modal options #10020

Closed
zakton5 opened this issue Jan 13, 2017 · 16 comments
Closed

ionic2 - enhancement(modal) - add cssClass property to modal options #10020

zakton5 opened this issue Jan 13, 2017 · 16 comments

Comments

@zakton5
Copy link
Contributor

zakton5 commented Jan 13, 2017

Ionic version: (check one with "x")
[ ] 1.x
[x] 2.x

I'm submitting a ... (check one with "x")
[ ] bug report
[x] feature request
[ ] support request

Current behavior:
Currently, you cannot pass in a cssClass name into the modalOptions object as you can do on alerts, popovers, etc.

Expected behavior:
I would like to be able to pass in a cssClass into modalOptions.

@mhartington
Copy link
Contributor

I'm assuming you want to do custom style if you present a page as a modal?

@wbhob
Copy link

wbhob commented Jan 16, 2017

Just put it in your modal sass file.

@zakton5
Copy link
Contributor Author

zakton5 commented Jan 16, 2017

@mhartington Yes, essentially
@wbhob I want to style the modal container, so putting in the modal's sass file won't have any effect.

@mhartington
Copy link
Contributor

I don't think we'd add this for 2.0 final, but you could get something by just targeting the component in scss.

so my-modal-page.scss

.modal-wrapper my-modal-page{
  // custom styles that will only be applied to my modal page component
}

@zakton5
Copy link
Contributor Author

zakton5 commented Jan 19, 2017

@mhartington That will not work, because what I really want to achieve here is styling the .modal-wrapper itself, not the page contents. Basically, based on the modal, I want to make it larger, smaller, or full screen. Currently there is no way to do that for modals, unlike popovers, etc.

Also, why would you close this? Just because it can't be done in time for 2.0 final doesn't mean it should not be done eventually...

@wbhob
Copy link

wbhob commented Jan 20, 2017

Mike gave you a solution. That DOES resize your actual modal, not the content. It doesn't need to be in 2.0 final because the solution is right there. Please try it before saying it doesn't work.

@zakton5
Copy link
Contributor Author

zakton5 commented Jan 23, 2017

I had already tried it before even posting this issue. It doesn't work as desired. The following is Ionic's CSS for the modal-wrapper, which is what I want to change, but only for one specific modal.

.modal-wrapper {
    position: absolute;
    top: calc(50% - (600px/2));
    left: calc(50% - (600px/2));
    width: 600px;
    height: 600px;
}

Doing something like Mike suggested, such as below, does not resize the wrapper but only the page content itself, which in turn is not even positioned correctly due to the above css that modal-wrapper already has.

.modal-wrapper my-modal-page {
    width: 768px;
    height: 1024px;
}

What would really be desirable is to apply a class just as one would do for a Popover, which I have just tested again and does work.

.modal-wrapper.full-screen-modal {
    position: relative;
    width: 100%;
    height:100%;
}

@mhartington
Copy link
Contributor

Will keep this open for now.
We're in a bit of a feature lock for now in order to fix up any remaining issue for 2.0 final.

We'll revisit post 2.0.

@mhartington mhartington reopened this Jan 23, 2017
@zakton5
Copy link
Contributor Author

zakton5 commented Jan 23, 2017

no problem at all! thanks for reopening. best of luck on the 2.0 final release.

@rajeevriitm
Copy link

Any updates on this? I would like to have different size for different modals in my app.

@szerner
Copy link

szerner commented Mar 7, 2017

I second that feature request. In a Popover component we can apply custom styling via the cssClass option property. Unfortunately, popovers cannot have a fixed header as documented in this still open issue. But if we switch to modals (with correct header fixing) we lose the ability to style them individually.

So for my purposes I would need a individually stylable modal or a popover with the header fixed as intended.

@sachithd
Copy link

This is exactly what I'm looking for. I'm working on a pwa and need different sized modal windows in my application. Also it would be nice to have options if we can make the modal window re-sizeable and also draggable (eg: example)

brandyscarney added a commit that referenced this issue Apr 6, 2017
Can pass one cssClass or multiple (same as out other overlays). Added a
cssClass to the basic test which adds 2 classes and styles the font
color of the content blue.

Closes #10020
@brandyscarney
Copy link
Member

Thanks for the issue! I submitted a PR for this here: #11103

I've released a nightly based off of our 3.x version (see the changelog to upgrade). You can install this nightly by running the following:

npm install --save --save-exact ionic-angular@3.0.1-201704062237

Please let me know if you see any issues with this implementation, thanks!

manucorporat pushed a commit that referenced this issue Apr 6, 2017
Can pass one cssClass or multiple (same as out other overlays). Added a
cssClass to the basic test which adds 2 classes and styles the font
color of the content blue.

Closes #10020
@sachithd
Copy link

sachithd commented Apr 7, 2017 via email

ammulder added a commit to ammulder/ionic that referenced this issue May 26, 2017
brandyscarney pushed a commit that referenced this issue May 26, 2017
@zjx
Copy link

zjx commented Jan 9, 2018

thanks, cssClass works fine!

@ionitron-bot
Copy link

ionitron-bot bot commented Sep 1, 2018

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.

@ionitron-bot ionitron-bot bot locked and limited conversation to collaborators Sep 1, 2018
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

8 participants