a11y_dateInput: Accessible date input

View source: R/inputs.R

a11y_dateInputR Documentation

Accessible date input

Description

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

Usage

a11y_dateInput(
  inputId,
  label,
  value = NULL,
  min = NULL,
  max = NULL,
  format = "yyyy-mm-dd",
  startview = "month",
  weekstart = 1,
  language = "en",
  width = NULL,
  ...,
  describedby = NULL,
  describedby_text = NULL,
  heading_level = NULL,
  aria_controls = NULL
)

Arguments

inputId

Input ID

label

Visible label (required)

value

Initial date value (Date or string, optional)

min

Minimum date (optional)

max

Maximum date (optional)

format

Date format (as in shiny::dateInput(), default: "yyyy-mm-dd")

startview

Initial view ("month", "year", "decade"; default: "month")

weekstart

First day of the week (1 = Monday, default: 1)

language

Language for the datepicker (default: "en")

width

Control width (optional)

...

Additional arguments for shiny::dateInput()

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 date input
a11y_dateInput("start", "Start date")

# With German datepicker, custom format and description
a11y_dateInput("birthday", "Date of birth",
  format = "dd.mm.yyyy",
  language = "de",
  describedby_text = "Enter your date of birth"
)

# Date input with heading-level annotation
a11y_dateInput("mydate", "Select date:",
  language = "de",
  heading_level = 2
)


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