| a11y_highContrastButton | R Documentation |
A toggle button that switches high-contrast mode by adding/removing the CSS
class .high-contrast on the <body> element, with ARIA attributes
according to BITV 2.0.
a11y_highContrastButton(
inputId = "toggle_contrast",
label = "Contrast Mode",
icon = shiny::icon("adjust"),
aria_label = "Toggle high-contrast mode on or off",
...
)
inputId |
Button ID (default: |
label |
Visible label (optional, e.g. |
icon |
Optional icon, e.g. |
aria_label |
ARIA label (required if |
... |
Additional arguments for |
Uses a11y_actionButton() internally (visible label or aria-label).
Sets aria-pressed and toggles this state via JS.
Adds the class .a11y-high-contrast-toggle to which the JS is attached.
HTML tag of the button component
# Default high-contrast toggle button
a11y_highContrastButton()
# Custom label in English
a11y_highContrastButton(
label = "High Contrast",
aria_label = "Toggle high-contrast mode"
)
# Icon-only toggle (no visible label)
a11y_highContrastButton(
label = NULL,
icon = shiny::icon("adjust"),
aria_label = "Toggle high-contrast mode"
)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.