Vivid API

Flag

Displays a country flag based on an ISO country code.

Implementation

Informative vs Decorative Flags

  • Informative flags
    • Convey information not otherwise present in the page’s text.
    • Must set the label attribute to provide an accessible name.
  • Decorative flags
    • Duplicate information already present in the text, or are purely aesthetic.
    • Do not require a label.
    • When no label is provided, aria-hidden="true" is automatically applied.

Best Practices

Flags Are Non-Interactive

  • Do not use flags as interactive controls.
  • If you need an interactive flag, use a component designed for interaction (for example a Button) and include accessible text.

Resources