r - 有没有办法创建一个“?” r闪亮的图标操作按钮?
问题描述
我想知道是否有办法创建一个“?” 图标按钮,单击它会显示一条弹出消息,解释我的模型背后的原因。另外,我如何使它与我的 numericInput 小部件水平内联。
fileInput("file1", "Choose CSV File",
accept = c("text/csv",
"text/comma-separated-values,text/plain",
".csv")
),
helper(shiny_tag, icon = "question-circle", colour = NULL,
type = "markdown", title = "Help", content = "Content", size= "m",
buttonLabel = "Okay", easyClose = TRUE, fade = FALSE)
我尝试过的第二个解决方案也给我带来了问题。
actionButton("show", "Show modal dialog"),
server <- function(input, output) {
observeEvent(input$show, {
showModal(modalDialog(
title = "Somewhat important message",
"This is a somewhat important message.",
easyClose = TRUE,
footer = NULL
))
})
}
解决方案
尝试这个:
library(shiny)
ui <- fluidPage(
div(
class = "input-group",
tags$span(
style = "display: inline-block",
numericInput("a", "Some number", 0, width = "100%")
),
tags$span(
style = "vertical-align: bottom;",
actionButton("b", "", icon = icon("question"))
)
)
)
server <- function(input, output, session) {
observeEvent(input$b, {
showModal(modalDialog(
title = "Somewhat important message",
"This is a somewhat important message.",
easyClose = TRUE,
footer = NULL
))
})
}
shinyApp(ui, server)
推荐阅读
- python - 如何使用`django-filters`编写将在整数字段上使用范围过滤器的GraphQL查询?
- google-sheets - 如何使用多个单元格作为搜索参数来搜索单元格中的子字符串?[谷歌表格]
- php - 递归函数并添加到数组
- c++ - clang-tidy 找不到目标的公共标头
- javascript - 使用 react-router 做出反应的 url 的问题
- javascript - Socket.on 没有触发
- matlab - matlab绘制多个图并添加一条直线
- java - 如何在调用 Junit 时将客户端 ID 和客户端密码传递给方法
- javascript - 动态 HTML 上的事件绑定,使用 fetch 和 forEach 内
- javascript - 我的带有 create-react-app 的电子应用程序出错