a11y_textInput: Accessible text input

View source: R/inputs.R

a11y_textInputR Documentation

Accessible text input

Description

A wrapper for shiny::textInput() with ARIA attributes according to BITV 2.0, enforced visible label, optional heading annotation, custom CSS class, and sr-only description support.

Usage

a11y_textInput(
  inputId,
  label,
  value = "",
  width = NULL,
  placeholder = NULL,
  ...,
  describedby = NULL,
  describedby_text = NULL,
  heading_level = NULL,
  aria_controls = NULL
)

Arguments

inputId

Input ID

label

Visible label (required)

value

Initial text value (default: "")

width

Control width (optional)

placeholder

Placeholder text (optional)

...

Additional arguments for shiny::textInput()

describedby

ID of an element for aria-describedby (optional)

describedby_text

Creates an sr-only ⁠<div>⁠ that serves as a description and is linked via aria-describedby. If describedby is set, its ID is used, otherwise an ID is generated (⁠<inputId>-desc⁠). (optional)

heading_level

1–6, marks the visible ⁠<label>⁠ as a heading via role="heading" and aria-level (optional)

aria_controls

(optional) ARIA controls attribute

Value

HTML tag of the input component (possibly with sr-only description)

Examples

# Basic text input
a11y_textInput("name", "Full name")

# With placeholder and screen-reader description
a11y_textInput("email", "E-mail address",
  placeholder = "user@example.com",
  describedby_text = "We will never share your e-mail"
)

# With heading-level annotation (for sectioned forms)
a11y_textInput("company", "Company name",
  heading_level = 3
)

# Linking to an existing description element via its ID
a11y_textInput("query", "Search query",
  describedby = "query_help"
)


a11yShiny documentation built on April 1, 2026, 5:07 p.m.