如何以闪亮的方式内嵌显示小部件 [英] How to display widgets inline in shiny

查看:39
本文介绍了如何以闪亮的方式内嵌显示小部件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有以下代码可以在闪亮的情况下内联(在同一行)显示小部件

I have the below code to display the widgets inline(in same row) in shiny

div(style="display:inline-block; width: 150px;height: 75px;",selectInput("ddllgra", "Function:",c('mean','median','sd','count','min','max'), selected='mean')),
div(style="display:inline-block; width: 150px;height: 75px;",textInput(inputId="xlimitsmax", label="x-max", value = 0.5))

它在 UI 中出现,但不在相同的行顺序中.一个从上侧进入,另一个从下侧进入同一行.

It is coming out in UI, but not in the same line order. one in coming in the upper side and other is coming on the lower side one the same line.

有没有办法纠正这种错位?

Is there a way to correct this misalignment?

推荐答案

vertical-align:top 添加到您的 style

rm(list = ls())
library(shiny)

ui <- fluidPage(
    sidebarPanel(
          div(style="display: inline-block;vertical-align:top; width: 150px;",selectInput("ddllgra", "Function:",c('mean','median','sd','count','min','max'), selected='mean')),
          div(style="display: inline-block;vertical-align:top; width: 150px;",textInput(inputId="xlimitsmax", label="x-max", value = 0.5))),
    mainPanel()
)
server <- shinyServer(function(input,output){})
shinyApp(ui, server)

如何在 div 之间添加空格

您可以使用相同的方法:下面的示例在 div 之间具有 100px

You can use the same approach: Example below has 100px between the divs

rm(list = ls())
library(shiny)

ui <- fluidPage(
  sidebarPanel(
    div(style="display: inline-block;vertical-align:top; width: 150px;",selectInput("ddllgra", "Function:",c('mean','median','sd','count','min','max'), selected='mean')),
    div(style="display: inline-block;vertical-align:top; width: 100px;",HTML("<br>")),
    div(style="display: inline-block;vertical-align:top; width: 150px;",textInput(inputId="xlimitsmax", label="x-max", value = 0.5))),
  mainPanel()
)
server <- shinyServer(function(input,output){})
shinyApp(ui, server)

这篇关于如何以闪亮的方式内嵌显示小部件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆