Skip to contents

A shadcn-styled multi-line <textarea>. Bound by Shiny's native binding; shiny::updateTextAreaInput() works. autosize = TRUE grows the control to fit its content (behavior handled by the bundled JS).

Usage

shad_textarea(
  inputId,
  label = NULL,
  value = "",
  placeholder = NULL,
  rows = 3,
  autosize = FALSE,
  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.

rows

Initial visible rows.

autosize

If TRUE, the textarea grows with its content.

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

A <textarea> tag, optionally wrapped in a form field.

Examples

shad_textarea("bio", label = "Bio", placeholder = "Tell us about yourself")
#> <div class="shad-form-field" data-shad="form-field">
#>   <label class="shad-label">Bio</label>
#>   <textarea id="bio" class="shad-textarea" placeholder="Tell us about yourself" rows="3"></textarea>
#>   <p class="shad-form-field__error" hidden></p>
#> </div>
shad_textarea("msg", autosize = TRUE)
#> <textarea id="msg" class="shad-textarea" rows="3" data-shad="textarea" data-autosize></textarea>