-
Notifications
You must be signed in to change notification settings - Fork 147
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
Implementing "Card Reveal" using ipyvuetify #628
Comments
Hey @sheffier! This should do the trick: import solara
show = solara.reactive(False)
@solara.component
def Page():
with solara.v.Html(tag="div", style_="position: relative; top: 50px; left: calc(50% - 250px); width: 500px;"):
with solara.Card(style={"height": "500px"}):
solara.Markdown("# Content 1")
solara.v.Spacer(vertical=True)
solara.Button("Click me", color="primary", on_click=lambda: show.set(True))
with solara.v.ExpandTransition():
if show.value:
with solara.Card(style={"height": '500px' if show.value else '0', "width": "100%", "position": "absolute", "bottom": "0", "left": "0", "margin": "0 !important"}, classes=["transition-fast-in-fast-out", "v-card--reveal"]):
solara.Markdown("# Content 2")
solara.Button("click me", color="secondary", on_click=lambda: show.set(False)) Run and edit this code at PyCafe Where did you get stuck on your first try? Is there something we could improve about the documentation that would have helped you? |
Yep, this did the trick!
I am a data scientists with no WEB development skills.
I don't know if any improvement to the docs would have helped me. However, a more programmatically way to implement this would have helped. For example: with ExpandTransition():
with Card():
...
with Card():
.... Thanks! |
BTW @iisakkirotko, The following code snippet worked even better: import solara
show = solara.reactive(False)
@solara.component
def Page():
with solara.Card(style="min-height: 230px; height: 100%"):
solara.Markdown("# Content 1")
with solara.v.ExpandTransition():
if show.value:
with solara.Card(
style={
"height": "100%" if show.value else "0",
"width": "100%",
"position": "absolute",
"bottom": "0",
"left": "0",
"margin": "0 !important",
},
classes=["transition-fast-in-fast-out", "v-card--reveal"],
):
solara.Markdown("# Content 2")
with solara.v.CardActions(style_="position: absolute; bottom: 0; left: 0;"):
if not show.value:
solara.Button("Options", color="primary", on_click=lambda: show.set(True))
else:
solara.Button("Close", color="secondary", on_click=lambda: show.set(False)) |
Hi,
I'm trying to figure out how to implement a Card Reveal component (using ipyvuetify/reacton/solara), similar to the example shown on vuetify docs.
Thanks
The text was updated successfully, but these errors were encountered: