| a11y_selectInput | R Documentation |
A wrapper for shiny::selectInput() with ARIA attributes according to
BITV 2.0, enforced visible label, optional heading annotation, custom CSS
class, and sr-only description support.
a11y_selectInput(
inputId,
label,
choices,
selected = NULL,
multiple = FALSE,
...,
describedby = NULL,
describedby_text = NULL,
heading_level = NULL,
aria_controls = NULL
)
inputId |
Input ID |
label |
Visible label (required) |
choices |
Choice list (as in |
selected |
Preselection (optional) |
multiple |
Multiple selection (default: |
... |
Additional arguments for |
describedby |
ID of an element for |
describedby_text |
Creates an sr-only |
heading_level |
1–6, marks the visible |
aria_controls |
(optional) ARIA controls attribute |
HTML tag of the input component (possibly with sr-only description)
# Basic select input
a11y_selectInput("colour", "Colour",
choices = c("Red", "Green", "Blue")
)
# With a screen-reader-only description
a11y_selectInput("size", "Size",
choices = c("S", "M", "L"),
describedby_text = "Choose a t-shirt size"
)
# Label promoted to a heading (useful for sectioned forms)
a11y_selectInput("n_breaks", "Number of bins",
choices = c(10, 20, 35, 50),
selected = 20,
heading_level = 3
)
# Linking to an existing description element via its ID
htmltools::tags$p(id = "n_breaks_help", "Choose how many bins to display")
a11y_selectInput("n_breaks2", "Number of bins",
choices = c(10, 20, 35, 50),
describedby = "n_breaks_help"
)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.