【问题标题】:How to create custom's User Interface?如何创建自定义的用户界面?
【发布时间】:2020-10-21 11:46:47
【问题描述】:

我无意中在website 中看到了这个用户界面,我首先想到的是“哦......这是一个闪亮的用户界面,似乎开发人员使用了shinydashboard::dashboardHeader()shinydashboard::dashboardBody()shinydashboard::dashboardSidebar()",好吧,但是怎么做呢?我从来没有见过创建类似东西的函数..我意识到actionButton(),但是如何做到这一点:

library(shiny)

ui <- fluidPage( 
# here

actionButton("button","Faça Login e assine")
  
)

server <- function(input, output, session) {
 
 observeEvent(input$button, {
## do something 
})
}

shinyApp(ui, server)

【问题讨论】:

    标签: r shiny


    【解决方案1】:

    您可以使用闪亮的普通box() 功能以及hr() 并执行以下操作:

    library(shiny)
    library(shinydashboard)
    
    ui <- dashboardPage( 
      dashboardHeader(),
      dashboardSidebar(),
      dashboardBody(
      box(title="TITLE",status="primary",solidHeader=TRUE,style="",
          width=2,
          h1(strong("$89,90")),
          h5("Some text here"),
          hr(),
          h4("More text"),
          hr(),
          h4("More text"),
          hr(),
          h4("More text"),
          hr(),
          h4("More text"),
          hr(),
          actionButton("button","Login and subscribe",class="btn-primary")
      ))
      
      
    )
    
    server <- function(input, output, session) {
      
      observeEvent(input$button, {
        ## do something 
      })
    }
    
    shinyApp(ui, server)
    

    这会给出如下输出:

    在此之后,您可以随时使用 css 自定义框内的颜色和字体。

    我希望这能回答你的问题!

    【讨论】:

      猜你喜欢
      • 2011-02-21
      • 2020-03-06
      • 1970-01-01
      • 2011-08-27
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2012-02-25
      相关资源
      最近更新 更多