-
Notifications
You must be signed in to change notification settings - Fork 154
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
[Feat] Enable variant argument inside Container
#1002
Conversation
View the example dashboards of the current commit live on PyCafe ☕ 🚀Updated on: 2025-03-04 17:28:05 UTC Compare the examples using the commit's wheel file vs the latest released version: vizro-core/examples/scratch_devView with commit's wheel vs View with latest release vizro-core/examples/dev/View with commit's wheel vs View with latest release vizro-core/examples/visual-vocabulary/View with commit's wheel vs View with latest release vizro-ai/examples/dashboard_ui/ |
for more information, see https://pre-commit.ci
for more information, see https://pre-commit.ci
…izro into dev/styled-containers
for more information, see https://pre-commit.ci
Container
for more information, see https://pre-commit.ci
…izro into dev/styled-containers
@antonymilne and @petar-qb or @nadijagraca - could I ask you guys for a new review? We decided to not introduce the |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
[EDIT] - This comment is moved into #1002 (comment) to continue the conversation in that comment thread.
First of all, I'm so happy we abandoned the background=True/False
idea! 😅
As theme
feels misleading, I'll use style_variant
in the rest of the comment as it feels much more natural to me 😄
Before merging this PR, I think we should establish a rough plan for style_variant
. In future I see that we will upgrade this solution to another level and that we will have a predefined set like "transparent"
, "filled"
, "outlined"
, "elevated"
, "rounded"
... In that case each component could have a default like for example, "transparent"
for Container
, "filled"
for Card
and Alert
, while Button
might include additional options like "link"
and "disabled"
.
Open questions:
1. Should we default Container to "transparent"
instead of None
?
2. Should we align our style_variant
values with existing standards like Bootstrap, or define our own? Caution: users could require something like "rounded-elevated"
🤔
While we don’t need a full plan before merging, having a clear direction will help ensure consistency. Looking forward to your thoughts! 🚀
vizro-core/changelog.d/20250217_105619_huong_li_nguyen_styled_containers.md
Outdated
Show resolved
Hide resolved
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is amazing, thank you for all your work on it! I know it's taken a lot of discussion 😅 It looks great and happy to approve now subject to a few things being resolved:
- finalise argument name
- decide what should be the possible values for
theme
(or whatever name it has) - something other thanNone
might be better - a couple of new tests
There's two other issues worth considering but I don't think we need to do anything about them before merging.
- Implications this has for
vm.Card
and proposed newText
component - let's discuss in our 1-1 tomorrow - Check out this Pycafe example (screenshot below). Do we care that there's no way to turn the background color back to the original unfilled colour in the case of a filled container inside a filled container? i.e. the top right is the same as the bottom right and there's not an easy way to get the inverse background color (how would you do it with
extras={"className": ...}
?). Not a big deal for me and I don't want to add lots of extra complexity or any crazy dynamic changing of class names depending on parent containers. But maybe there should be another available theme that somehow doesunfilled
. But then what if you want to dounfilled + border
, it would need to be another option... So probably best just to ignore this I think unless you have a bright idea 😁
vizro-core/changelog.d/20250217_105619_huong_li_nguyen_styled_containers.md
Outdated
Show resolved
Hide resolved
![]() If we think we want to support that, I can just add this into our static CSS, but I am also fine just not encouraging people to do that haha 😄 |
Container
Container
vizro-core/changelog.d/20250217_105619_huong_li_nguyen_styled_containers.md
Outdated
Show resolved
Hide resolved
Just talked with J. and he wanted the first level of nesting to work, so I'll add that CSS, in which case your example will also work out of the box @antonymilne |
Description
html.Div
withdbc.Container
in the underlying model. We enablefluid=True
to ensure containers expand to 100% of the available width, following Bootstrap's container behavior: Bootstrap Containers.variant
argument invm.Container(..., variant="filled")
. Available options: "filled", "outlined" and "plain" with "plain" being the defaultNote on "elevated": We need more testing on both the design and development side. Box shadows are not visible in dark mode, so to make "elevated" work, we'd have to use both shadows and a background color. But in a dark theme, that would end up looking like "filled." Plus, we'd need dynamic margin adjustments to keep shadows from getting cut off. After discussing with J., we’ve decided to put "elevated" on hold for now since it wasn’t part of the original plan.
Screenshot
Notice
I acknowledge and agree that, by checking this box and clicking "Submit Pull Request":