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

Additional ui.card features #951

Open
lucas-nelson-uiuc opened this issue Dec 29, 2023 · 0 comments
Open

Additional ui.card features #951

lucas-nelson-uiuc opened this issue Dec 29, 2023 · 0 comments

Comments

@lucas-nelson-uiuc
Copy link

lucas-nelson-uiuc commented Dec 29, 2023

Really enjoy working with ui.card() - would love if one of the two ideas could be implemented below:

  1. ui.card_body()
    Noticed this in experimental so just showing support for it making it to the core package one day.
  2. ui.card(..., on_full_screen: Callable = func)
    Sometimes my cards have a lot of text or would benefit from having additional, more detailed content than available in the rendered card. I was wondering if there could be an additional argument passed to ui.card() called on_fullscreen that, when the card enters full_screen mode, renders additional, more detailed content.

Example

from htmltools._core import Tag

def render_additional_detail() -> Tag:
    # include tables, plots, etc.
    return ui.div(...)

ui.card(
    # render in full screen or not-------
    ui.card_header('Header'),
    ui.p('initially rendered body'),
    ui.card_footer('Footer'),
    # ---------------------------------
    full_screen=True,
    # render when in full screen-------
    on_full_screen=render_additional_detail
    # ---------------------------------
)
  1. Possible implementation of both ideas
    I think something like this could work to implement both ideas (could also alleviate need for callable like above).
ui.card(
    ui.card_header('Header'),
    ui.card_body('some text'), # appears in rendered card
    ui.card_body('magic text', full_screen_only=True), # appears only in `full_screen` mode
   # ... additional card body elements, like tables, plots, etc.
    ui.card_footer('Footer'),
    full_screen=True
)

Let me know if either of these are already implemented and I'm missing something. Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant