a11y_numericInput: Accessible numeric input

View source: R/inputs.R

a11y_numericInputR Documentation

Accessible numeric input

Description

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

Usage

a11y_numericInput(
  inputId,
  label,
  value,
  min = NA,
  max = NA,
  step = NA,
  ...,
  describedby = NULL,
  describedby_text = NULL,
  heading_level = NULL,
  aria_controls = NULL
)

Arguments

inputId

Input ID

label

Visible label (required)

value

Initial numeric value

min

Minimum value (optional; NA for none)

max

Maximum value (optional; NA for none)

step

Step size (optional; NA for none)

...

Additional arguments for shiny::numericInput()

describedby

ID of help text 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

Examples

# Basic numeric input
a11y_numericInput("age", "Age", value = 30, min = 0, max = 120)

# With heading-level annotation and description
a11y_numericInput("score", "Score",
  value = 0,
  min = 0, max = 100,
  heading_level = 3,
  describedby_text = "Enter a value between 0 and 100"
)

# Linking to an existing help-text element by its ID
a11y_numericInput("seed", "Seed",
  value = 123,
  describedby = "seed_help"
)


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