-
Notifications
You must be signed in to change notification settings - Fork 37
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
How to change the style? #2
Comments
@igorissen you can update the css by applying to the internal classes:
You can override these by applying higher specificity to the classes. For instance : Please note that in ng2+ components usually have encapsulated css, to apply these styles better apply it not to a component style. |
@MrFrankel, Thank you! |
@MrFrankel , even with higher specificity, overriding the classes didn't work for me unless I use the !important rule. |
@alexandremoore there is a global option for disableDefaultStyling, if you set it in the forRoot as true it will disable any default styles and you can apply your own |
@MrFrankel, is it possible to access the 'dataObject'? Looking at the Popper.js docs I was hoping to use the "data.arrowStyles" property to modify the arrow styles instead of disabling the default styling or getting into a "!important" specificity war... (https://popper.js.org/popper-documentation.html#dataObject) |
@IBYuMe you can access the dataObject by passing modifiers to the popper |
@MrFrankel Thank you for the quick response!
I was having trouble finding examples on how to write custom modifiers so I based the above modifier on a mixture of documentation and looking at this react example: floating-ui/react-popper#73. I also tried to create a codePen ( https://codepen.io/IBYuMe/pen/qoZjyZ?editors=1111), but I can't seem to get the ngx-popover imported/working in codepen..... I was looking at https://codepen.io/FezVrasta/pen/jqxYLK for reference, but it looks like even FezVrasta's popper example doesn't work quite right in codePen...(?) |
@IBYuMe I think the best solution would be for me to supply a way to inject a class to override the .ngx__container class, that way you can provide any class name you want and define and css props on that directly. Does that sound useful? |
@MrFrankel Yes! That would be very useful, thanks! I've been looking for something like that, but hadn't been able to find it. So far, I've managed to hack the style of most of the popovers by defining a global class that had about 5 layers of nested specificity... However the css still wasn't specific enough to change certain popovers that were deeply nested in components, so I was looking at trying to change arrowStyles. If there was a way to overwrite the default .ngx__container and .ngx__arrow styles that would be really great! |
@IBYuMe ive released this under 2.3.1, You can now simply add the applyClass option in the forRoot global props or add it to a specific popper via an input such:
Let me know if this helps. |
@MrFrankel Thank you very much for adding the feature- I'm sorry for the delay but I haven't had a chance to work on this all week... Once I get a chance to try out the new version I'll add an update to say if it fixed my issue. |
@MrFrankel Thank you for this change! It has allowed me to get enough specificity to style all the popovers in my app. Would it be difficult to add a similar ' [popperApplyArrowClass]’to put a css class directly on the arrow component? I feel like that would make the css cleaner, right now I need to specify an extra class ‘popover-content' on the actual ‘popover-content’ element to create extra specificity and get the arrow css to be applied properly. I’ve copied my ’no-arrow’ class and other CSS notes in case it helps anyone else:
|
@IBYuMe first, it would be better to open a new issue for this, as this issue is already closed. |
@MrFrankel thank you for all of your help! |
Hi,
This isn't an issue but a question about the popup styling.
How can we update the popup with my style?
Thanks
The text was updated successfully, but these errors were encountered: