disabled {shinyjs} | R Documentation

## Initialize a Shiny input as disabled

### Description

Create a Shiny input that is disabled when the Shiny app starts. The input can be enabled later with `shinyjs::toggleState` or `shinyjs::enable`.

### Usage

    disabled(...)

### Arguments

`...` | Shiny input (or tagList or list of of tags that include inputs) to disable.

### Value

The tag (or tags) that was given as an argument in a disabled state.

### Note

`shinyjs` must be initialized with a call to `useShinyjs()` in the app's ui.

### See Also

`useShinyjs`, `toggleState`, `enable`, `disable`

### Examples

    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))

[Package shinyjs version 0.8 Index]