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

More supports on class, style, and other attributes for UI #2548

Open
wants to merge 7 commits into
base: main
Choose a base branch
from

Conversation

atusy
Copy link

@atusy atusy commented Aug 9, 2019

This PR makes following changes as written in NEWS.md

  • Added class and ... arguments to *Output functions, so that these functions
    can take more controlls on the outputs' containers (generally div or span).

  • Added style arguments to plotOutput and imageOutput, so that addtional CSS
    styles can be applied to them.

  • Resolved inconsitency in class argument among downloadButton(), downloadLink() and icon().
    The class argument can be a character vector for downloadLink(), but not for others.
    Now all of them accepts a vector.

Usage example

To apply display: inline-block to plots to arrange them,
currently they have to be wrapped by additional div (see ui).

This PR removes additional div (see ui_new).

library(shiny)
library(ggplot2)

p <- ggplot2::qplot(1, 1)

server <- function(input, output, session) {
  output$a <- output$b <- output$c <- renderPlot(p)
}

# ui's are wrapped by div
ui <- fluidPage(
  plotOutput("a", width = 200, height = 200) %>% tags$div(style = "display: inline-block"),
  plotOutput("b", width = 200, height = 200) %>% tags$div(style = "display: inline-block"),
  plotOutput("c", width = 200, height = 200) %>% tags$div(style = "display: inline-block")
)

# ui's does not have to be wrapped by div anymore
ui_new <- fluidPage(
  plotOutput("a", width = 200, height = 200, style = "display: inline-block"),
  plotOutput("b", width = 200, height = 200, style = "display: inline-block"),
  plotOutput("c", width = 200, height = 200, style = "display: inline-block")
)

# compare
runGadget(ui, server)
runGadget(ui_new, server)

@atusy
Copy link
Author

atusy commented Aug 9, 2019

Note: I have signed to contributor agreement when I contributed to bookdown

@CLAassistant
Copy link

CLAassistant commented Oct 2, 2019

CLA assistant check
All committers have signed the CLA.

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

Successfully merging this pull request may close these issues.

2 participants