Skip to contents

A shadcn-styled <input>. Bound by Shiny's native text-input binding, so input$<inputId> reflects the value and shiny::updateTextInput() works.

Usage

shad_input(
  inputId,
  label = NULL,
  value = "",
  placeholder = NULL,
  type = "text",
  invalid = FALSE,
  disabled = FALSE,
  description = NULL,
  width = NULL,
  class = NULL,
  ...
)

Arguments

inputId

Input id.

label

Optional label (wraps in shad_form_field()).

value

Initial value.

placeholder

Placeholder text.

type

Input type attribute ("text", "email", "password", ...).

invalid

If TRUE, sets aria-invalid="true" (destructive border).

disabled

If TRUE, disables the input.

description

Optional help text (wraps in shad_form_field()).

width

CSS width.

class

Extra CSS classes.

...

Extra attributes.

Value

An <input> tag, optionally wrapped in a form field.

Examples

shad_input("email", type = "email", placeholder = "you@example.com")
#> <input id="email" class="shad-input" type="email" placeholder="you@example.com"/>
shad_input("user", label = "Username", value = "shadcn")
#> <div class="shad-form-field" data-shad="form-field">
#>   <label class="shad-label">Username</label>
#>   <input id="user" class="shad-input" type="text" value="shadcn"/>
#>   <p class="shad-form-field__error" hidden></p>
#> </div>