a11y_actionButton: Accessible action button

View source: R/inputs.R

a11y_actionButtonR Documentation

Accessible action button

Description

A wrapper for shiny::actionButton() with ARIA attributes according to BITV 2.0, enforced visible label or aria-label, and custom CSS class.

Usage

a11y_actionButton(
  inputId,
  label = NULL,
  icon = NULL,
  aria_label = NULL,
  aria_controls = NULL,
  ...
)

Arguments

inputId

Button ID

label

(optional) Visible label

icon

(optional) Icon, e.g. shiny::icon("check")

aria_label

(optional, but required if label is missing or empty) ARIA label for buttons without text

aria_controls

(optional) ARIA controls attribute

...

Additional arguments for shiny::actionButton()

Value

HTML ⁠<button>⁠ tag with appropriate ARIA attributes

Examples

# Button with a visible label
a11y_actionButton("btn1", label = "Submit")

# Icon-only button (aria_label required)
a11y_actionButton("btn2",
  icon = shiny::icon("search"),
  aria_label = "Search"
)

# Button with aria-controls linking to another element
a11y_actionButton("btn3",
  label = "Toggle",
  aria_controls = "panel1"
)

# Button with visible label, icon, and additional aria-label
a11y_actionButton("refresh",
  label = "Refresh",
  icon = shiny::icon("refresh"),
  aria_label = "Click to refresh data"
)


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