Description Usage Arguments Value Note See Also Examples
Create a Shiny input that is disabled when the Shiny app starts. The input can
be enabled later with toggleState()
or enable()
.
1 |
... |
Shiny input (or tagList or list of of tags that include inputs) to disable. |
The tag (or tags) that was given as an argument in a disabled state.
shinyjs
must be initialized with a call to useShinyjs()
in the app's ui.
useShinyjs()
, toggleState()
, enable()
, disable()
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 | if (interactive()) {
library(shiny)
shinyApp(
ui = fluidPage(
useShinyjs(), # Set up shinyjs
actionButton("btn", "Click me"),
disabled(
textInput("element", NULL, "I was born disabled")
)
),
server = function(input, output) {
observeEvent(input$btn, {
enable("element")
})
}
)
}
library(shiny)
disabled(numericInput("num", NULL, 5), dateInput("date", NULL))
|
Attaching package: 'shinyjs'
The following objects are masked from 'package:methods':
removeClass, show
Attaching package: 'shiny'
The following object is masked from 'package:shinyjs':
runExample
[[1]]
<div class="form-group shiny-input-container shinyjs-disabled">
<input id="num" type="number" class="form-control" value="5"/>
</div>
[[2]]
<div class="shiny-date-input form-group shiny-input-container shinyjs-disabled" id="date">
<input type="text" class="form-control" data-date-language="en" data-date-week-start="0" data-date-format="yyyy-mm-dd" data-date-start-view="month"/>
</div>
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.