如何使菜單項徽章與默認對齊方式不同? 在shinyUI:shinydashboard徽章menuitem
menuItem("Test", tabName = "test", icon = icon("line-chart"),badgeLabel = "2nd", badgeColor = "green")
完整例如:
library(shiny)
library(shinydashboard)
# Default shiny
ui <- dashboardPage(
dashboardHeader(title = "Example"),
dashboardSidebar(
sidebarMenu(
menuItem("Test", tabName = "test", icon = icon("line-chart"),
badgeLabel = "2nd", badgeColor = "green")
)),
dashboardBody(
tabItems(
tabItem(tabName = "test",
box(title = "How-to",status = "primary",solidHeader = TRUE,collapsible=TRUE, width = 8,
sliderInput("bins",
"Number of bins:",
min = 1,
max = 50,
value = 30),
# Show a plot of the generated distribution
plotOutput("distPlot")
)
)
)))
# Define server logic required to draw a histogram
server <- function(input, output) {
output$distPlot <- renderPlot({
# generate bins based on input$bins from ui.R
x <- faithful[, 2]
bins <- seq(min(x), max(x), length.out = input$bins + 1)
# draw the histogram with the specified number of bins
hist(x, breaks = bins, col = 'darkgray', border = 'white')
})
}
# Run the application
shinyApp(ui = ui, server = server)
在瀏覽器檢查它示出了下面的代碼/:
<small class="badge pull-right bg-green">2nd</small>
測試PIC
我需要:
<small class="badge center-block bg-green">2nd</small>
所需PIC
任何想法?
歡迎來到SO。請參閱[我如何提出一個好問題?](https://stackoverflow.com/help/how-to-ask),特別是包含足夠的代碼以允許其他人重現問題。有關此方面的幫助,請閱讀[如何創建最小,完整和可驗證示例](https://stackoverflow.com/help/mcve)。它將幫助每個人重現相同的問題並幫助你。 – rmjoia