You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
It'd be nice to directly support conditionally shown content in full-screen cards. Here's how you can get there today.
Add conditional content in a card_body() with class = "card-reveal-full-screen".
card(
"A fancy table",
card_body(
class="card-reveal-full-screen",
reactableOutput("table")
),
full_screen=TRUE
)
The class can be named anything else (in case you think of a better name); what's important is that it's coupled with some custom CSS in the next step.
Use custom CSS to toggle the visibility of that card body area.
The above CSS hides elements with .card-reveal-full-screen, conveniently hiding the table output in the example above. By using [data-full-screen="false"] we also stay out of the way of the default presentation when in full-screen mode; in this case the card_body() around the table wants to have display: flex.
We could add an argument to card_body(), e.g. card_body(show_when = c("both", "expanded", "collapsed")).
Or we could add a new function wrapping card_body(), e.g. card_body_full_screen().
I lean toward adding an argument to card_body() for discoverability, backwards compat, etc.
Naming is also complicated. I can see a use case for both showing and hiding content in the full screen mode, e.g. having a short summary that's replaced with longer content (note this can also be done with dynamic UI, but I think it'd be easier to reason about with an explicit argument/function). This means that a "full screen" option would have a paired "not full screen" option, which I find less compelling than "expanded" and "collapsed".
The text was updated successfully, but these errors were encountered:
Also worth noting: there's a way to do this using the input${card_id}_full_screen reactive. I think there is room for both approaches, especially because the server-managed hiding is a little cumbersome. (See rstudio/htmltools#434.)
Feature request
It'd be nice to directly support conditionally shown content in full-screen cards. Here's how you can get there today.
Add conditional content in a
card_body()
withclass = "card-reveal-full-screen"
.The class can be named anything else (in case you think of a better name); what's important is that it's coupled with some custom CSS in the next step.
Use custom CSS to toggle the visibility of that card body area.
The above CSS hides elements with
.card-reveal-full-screen
, conveniently hiding the table output in the example above. By using[data-full-screen="false"]
we also stay out of the way of the default presentation when in full-screen mode; in this case thecard_body()
around the table wants to havedisplay: flex
.Example app
Here's a full example also available on shinylive.io/r:
API brainstorm
Two options that occur to me:
card_body()
, e.g.card_body(show_when = c("both", "expanded", "collapsed"))
.card_body()
, e.g.card_body_full_screen()
.I lean toward adding an argument to
card_body()
for discoverability, backwards compat, etc.Naming is also complicated. I can see a use case for both showing and hiding content in the full screen mode, e.g. having a short summary that's replaced with longer content (note this can also be done with dynamic UI, but I think it'd be easier to reason about with an explicit argument/function). This means that a
"full screen"
option would have a paired"not full screen"
option, which I find less compelling than"expanded"
and"collapsed"
.The text was updated successfully, but these errors were encountered: