| a11y_textInputsGroup | R Documentation |
A wrapper for a group of related text input elements inside a
<fieldset>/<legend> with ARIA attributes according to BITV 2.0. Intended
for combined form elements that belong together (e.g. address fields, date
parts, etc.).
a11y_textInputsGroup(
groupId,
legend,
inputs,
describedby = NULL,
describedby_text = NULL,
legend_heading_level = NULL
)
groupId |
ID for the fieldset/group (used as id of |
legend |
Visible group label (used as |
inputs |
A list of input specifications. Each element must be a list with:
|
describedby |
ID of an element used for |
describedby_text |
Creates an sr-only |
legend_heading_level |
1–6, marks the visible |
The group gets a visible legend (required).
Each inner text input has its own ID.
For each inner input you must provide at least one of: a visible
label, an aria_label, or a title attribute.
The fieldset is marked as role="group" and is linked to the legend via
aria-labelledby.
HTML tag of the fieldset containing multiple text inputs (possibly with an sr-only group description)
# Address field group
a11y_textInputsGroup(
groupId = "address",
legend = "Address",
inputs = list(
list(inputId = "street", label = "Street"),
list(inputId = "city", label = "City"),
list(inputId = "zip", label = "ZIP code")
)
)
# With group description and legend promoted to heading level
a11y_textInputsGroup(
groupId = "address_full",
legend = "Postal address",
inputs = list(
list(inputId = "street2", label = "Street and number"),
list(inputId = "zip2", label = "ZIP code", width = "120px"),
list(inputId = "city2", label = "City"),
list(inputId = "country2", label = "Country")
),
describedby_text = "Please enter your full postal address.",
legend_heading_level = 3
)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.