a11y_textButtonGroup: Accessible text input with action button

View source: R/composites.R

a11y_textButtonGroupR Documentation

Accessible text input with action button

Description

A composite component combining a11y_textInput() and a11y_actionButton() with BITV 2.0-conform ARIA attributes. The text input enforces a visible label; the button enforces either a visible label or an aria-label. By default the button gets aria-controls pointing to the text input.

Usage

a11y_textButtonGroup(
  textId,
  buttonId,
  label,
  value = "",
  placeholder = NULL,
  button_label = NULL,
  button_icon = NULL,
  button_aria_label = NULL,
  controls = NULL,
  layout = c("inline", "stack"),
  text_describedby = NULL,
  text_describedby_text = NULL,
  text_heading_level = NULL
)

Arguments

textId

ID for the inner text input (required)

buttonId

ID for the inner action button (required)

label

Visible label for the text input (required)

value

Initial value for the text input (default: "")

placeholder

Placeholder for the text input (optional)

button_label

Visible label for the button (optional; if omitted/empty, button_aria_label is required)

button_icon

Icon for the button (e.g. shiny::icon("search"), optional)

button_aria_label

ARIA label for the button (required if button_label is missing or empty)

controls

ID referenced by aria-controls on the button. If NULL, defaults to textId.

layout

"inline" (default) or "stack". Inline places text and button in one row; stack places them under each other.

text_describedby

ID for aria-describedby of the text input (optional)

text_describedby_text

Creates an sr-only ⁠<div>⁠ as description for the text input. If text_describedby is set, that ID is used, otherwise ⁠<textId>-desc⁠ (optional)

text_heading_level

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

Value

HTML tag containing the labeled text input and button

Examples

# Search box with icon-only button
a11y_textButtonGroup(
    textId = "search_text",
    buttonId = "search_btn",
    label = "Search",
    placeholder = "Enter a keyword",
    button_icon = shiny::icon("search"),
    button_aria_label = "Run search"
)

# Stacked layout with visible button label
a11y_textButtonGroup(
    textId = "comment_text",
    buttonId = "comment_btn",
    label = "Comment",
    button_label = "Send",
    layout = "stack"
)

# With screen-reader description and heading-level on the label
a11y_textButtonGroup(
    textId = "query_text",
    buttonId = "query_btn",
    label = "Search query",
    placeholder = "Enter a keyword",
    button_icon = shiny::icon("search"),
    button_aria_label = "Run search",
    text_describedby_text = "Type a keyword and press the search button",
    text_heading_level = 3
)


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