-
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
[Poc] Implement collapsible container as a custom component #1042
base: main
Are you sure you want to change the base?
Conversation
for more information, see https://pre-commit.ci
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
for more information, see https://pre-commit.ci
…izro into dev/styled-containers
for more information, see https://pre-commit.ci
for more information, see https://pre-commit.ci
View the example dashboards of the current commit live on PyCafe ☕ 🚀Updated on: 2025-02-28 13:40:18 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
…izro into dev/styled-containers
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.
I just took a quick look—this works really well inside the FlexLayout! 🚀
I made some refactors in this PR: #1002, which also impacts your PR. It might be worth rebasing your branch on that one instead.
Regarding your question about coloring, I believe this should be controlled by setting theme="XX". However, we could check with J. if we want a different default for collapsible containers compared to regular containers (currently, the default is no styling). However, I agree with you, that collapsible containers should probably come pre-styled (I don't have a preference here whether it should be outlined or filled) as otherwise it's a bit difficult to visually distinguish where the collapsible container starts / ends.
return html.Div( | ||
children=[ | ||
html.Div( | ||
id=f"{self.id}_title", | ||
children=[ | ||
html.H3(self.title, className="container-title"), | ||
html.Span("keyboard_arrow_up", className="material-symbols-outlined", id=f"{self.id}_icon"), | ||
], | ||
className="collapsible-container-header", | ||
), | ||
dbc.Collapse( | ||
id=self.id, | ||
children=components_container, | ||
is_open=True, | ||
), | ||
], | ||
className="bg-container", | ||
) |
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.
Might be good to base this PR on this PR first: #1002
I refactored this part so it uses dbc.Container instead of html.Div. Hopefully it will work the same then 🤞
#old-line-height p { | ||
line-height: 1; | ||
margin-bottom: 0.5rem; | ||
.bg-container { |
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.
I've changed some of the CSS here in #1002
display: flex; | ||
flex-direction: row; | ||
justify-content: space-between; | ||
padding-right: 12px; |
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.
padding-right: 12px; |
Would remove so it's equal space on the left and right
], | ||
layout=vm.Layout(grid=[[0, 0, 0, 0], [1, 1, 1, 1]]), | ||
), | ||
] | ||
) | ||
], |
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.
Could you add the example of how this looks inside a grid? Is it completely unusable? 😄
), | ||
FlexContainer( | ||
components=[ | ||
CollapsibleContainer( |
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.
Did you try to control the scroll bar? e.g. is it possible that it expands to the available space only such that no scroll bar appears? 🤔 I think this can eventually get a bit tricky, but there should be a way how users could eventually control it
This is looking great, nice work @nadijagraca! Just a few questions for now, for @huong-li-nguyen and/or @nadijagraca:
|
[pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci more clientside callback to component build
We can go into more detail later, but for now, my understanding is that this should remain a custom component. It doesn't work well within a grid and only functions properly inside a FlexContainer. To incorporate this into vizro-core, we would need to:
However, I don't think we need to wait for publishing this custom component as it's ready to use as long as you put it inside a FlexLayout or you have the grid and no other component on screen 😄 And in the meantime we can work on the missing points above.
Everything you mentioned above and:
The side panel collapse is actually similarly implemented (@nadijagraca did that one as well, and there is custom JS code that also rotates the icons - correct me here if I am wrong @nadijagraca ). Our side panel however collapses side ways, so the starting position is different. But I think both need to rotate 180 degrees, so if we can consolidate code there, then that sounds great, but I'll leave that to @nadijagraca who knows best 👍 |
c2c6995
to
66aefb6
Compare
Description
This PR is meant to create collapsible container as a custom component.
CollapsibleContainer
component (for now) needs to be used withinFlexContainer
component (component that mimics flex layout).Discussion points:
Notice
I acknowledge and agree that, by checking this box and clicking "Submit Pull Request":