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

CSS styling not working for anywidget based widget in marimo #3313

Open
paddymul opened this issue Dec 30, 2024 · 1 comment
Open

CSS styling not working for anywidget based widget in marimo #3313

paddymul opened this issue Dec 30, 2024 · 1 comment
Labels
bug Something isn't working

Comments

@paddymul
Copy link

Describe the bug

I'm working on updating buckaroo to use anywidget. It renders to the dom in marimo, but the styling is really off.
Some of my divs aren't the correct width

Does marimo do anything special to css included with an anywidget widget that I should know about

I put the orange border in that div. but the rest is scrunched up against the left side.
Image
Here is the same widget rendered in jupyter lab
Image

I'm usre theres something that I can change in my code, I was curious if I was bumping up against a known bug. or there is a recommended workaround.

Environment

{
  "marimo": "0.10.8",
  "OS": "Darwin",
  "OS Version": "22.6.0",
  "Processor": "arm",
  "Python Version": "3.12.8",
  "Binaries": {
    "Browser": "131.0.6778.205",
    "Node": "v18.20.4"
  },
  "Dependencies": {
    "click": "8.1.8",
    "docutils": "0.21.2",
    "itsdangerous": "2.2.0",
    "jedi": "0.19.2",
    "markdown": "3.7",
    "narwhals": "1.19.1",
    "packaging": "24.2",
    "psutil": "5.9.0",
    "pygments": "2.18.0",
    "pymdown-extensions": "10.13",
    "pyyaml": "6.0.2",
    "ruff": "0.8.4",
    "starlette": "0.43.0",
    "tomlkit": "0.13.2",
    "typing-extensions": "4.12.2",
    "uvicorn": "0.34.0",
    "websockets": "14.1"
  },
  "Optional Dependencies": {
    "anywidget": "0.9.13",
    "pandas": "2.2.3",
    "polars": "1.18.0",
    "pyarrow": "17.0.0"
  }
}

Code to reproduce

pip install buckaroo

import pandas as pd
from buckaroo import BuckarooWidget
num_df = pd.DataFrame(
    {'a':[111_111,  77_777, 777_777, 1_000_000, 2_111_111, 1_235_999],
     'b':[111_111, 555_555,       0,    28_123,   482_388,     5_666]})
BuckarooWidget(num_df)
@paddymul paddymul added the bug Something isn't working label Dec 30, 2024
@mscolnick
Copy link
Contributor

We put our anywidget elements on shadow doms for better encapsulation of styling to avoid polluting the global namespace. That could be it, but not sure without looking into the stylesheets. I can take a look, if you can link them.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants