Skip to content

feat(card): Report full screen state as a Shiny input #1006

New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

Merged
merged 9 commits into from
Mar 13, 2024

Conversation

gadenbuie
Copy link
Member

Closes #962

When card() is given an id, e.g. card(id = "my_card"), the full screen state of the card is now reported as input$my_card$full_screen.

Note: this PR builds on #1005 but could be rebased on main to decouple.

Example

library(shiny)
# library(bslib)
pkgload::load_all()

ui <- page_fixed(
  card(
    card_header("Hello card!"),
    "A regular full-screenable card.",
    id = "my_card",
    full_screen = TRUE
  ),
  value_box(
    title = "Hello value box!",
    value = "$1,234,567",
    id = "my_value_box",
    full_screen = TRUE
  ),
  div(
    verbatimTextOutput("debug"),
    style = htmltools::css(
      z_index = 9999,
      position = "absolute",
      bottom = "2rem",
      left = "2rem",
      right = "2rem"
    )
  )
)

server <- function(input, output, session) {
  output$debug <- renderPrint({
    str(
      list(
        my_card = input$my_card,
        my_value_box = input$my_value_box
      )
    )
  })
}

shinyApp(ui, server)

@gadenbuie gadenbuie changed the base branch from card/fix-fullscreen-exit-by-removal to main March 12, 2024 15:20
@cpsievert cpsievert changed the base branch from main to card/fix-fullscreen-exit-by-removal March 12, 2024 19:40
@cpsievert
Copy link
Collaborator

cpsievert commented Mar 12, 2024

Note: this PR builds on #1005 but could be rebased on main to decouple.

Please do rebase off main as I have more reservations about that PR.

@gadenbuie gadenbuie force-pushed the card/shiny-input-full-screen branch from a852d27 to 4fac944 Compare March 13, 2024 02:07
@gadenbuie gadenbuie force-pushed the card/shiny-input-full-screen branch from 4fac944 to 10db8b2 Compare March 13, 2024 02:09
@gadenbuie gadenbuie changed the base branch from card/fix-fullscreen-exit-by-removal to main March 13, 2024 02:11
@gadenbuie gadenbuie force-pushed the card/shiny-input-full-screen branch from 10db8b2 to d838ccb Compare March 13, 2024 02:15
@gadenbuie gadenbuie marked this pull request as ready for review March 13, 2024 14:33
@gadenbuie gadenbuie merged commit 8751c7c into main Mar 13, 2024
1 check passed
@gadenbuie gadenbuie deleted the card/shiny-input-full-screen branch March 13, 2024 18:25
# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[card] Report full screen state as a Shiny input
2 participants