-
Notifications
You must be signed in to change notification settings - Fork 8
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
Importing custom css #39
Comments
Currently, you can do styling of widgets like mentioned in this walkthrough guide https://widgetti.github.io/ipyreact/lab/?path=full_tutorial.ipynb like this from IPython.display import HTML , display
from pathlib import Path
css_rules = Path('styles_orange.css').read_text()
display(HTML('<style>' + css_rules + '</style>')) But yes, a |
Indeed, this is not supported yet, we'd need to do something like in https://github.com/manzt/anywidget/blame/main/packages/anywidget/src/widget.js Happy to guide someone through a PR and get this in, but I currently don't have the bandwidth to do it myself. |
I do not think that should not be part of the same widget (I disagree with anywidget in that respect), you can also use https://solara.dev/api/style But we could think about adding a simple |
If all you care about is bundling the .css of your widget alongside it, you can use the SASS plugin of ESBuild to shove it into the .js file (it works with regular CSS too). Just make sure to import the .css somewhere in your javascript code.
|
Nice, thanks! |
Is it possible to import custom css?
anywidget lets you set
_css
, but (as far as I can tell), setting that to a file doesn't seem to do anything?I wanted to check if isn't supported, or isn't documented (and I'm possibly using it wrong..)
The text was updated successfully, but these errors were encountered: