Skip to
Keyboard shortcuts

Use the up and down arrow keys to move between items. Press Alt+Shift+K to open this list again.

Alpha version out now. The API may still change.

Address

Contact details for the page or the article around it, as the native address element. It adds no text, role or behaviour, and the default theme undoes the browser’s italic.

Package
@kvirn-ui/react
Testing
Not yet verified. Automated 4 of 5, Core n/a, Release n/a

When to use it#

  • Use it for the contact details of the page, or of the article around it: who runs the service, where to visit, how to phone or write.
  • Put a phone number or email address in a Link whose text is the number or the address.
  • Label each address in words. A visiting address and a postal address go in separate Address elements.
  • Put a heading above an Address, not inside it. The HTML standard does not allow headings in it.
  • Not for text that only looks like an address, such as a place in a news story: use a paragraph. Not for an address the user types: use an AddressInput. Not for an address the service holds: use a DefinitionList.

Example#

Kvirnby municipality
Storgatan 1
123 45 Kvirnby
+46 70 174 06 05
contact@kvirnby.example

Use cases#

A visiting address and a postal address

Residents visit one address and post to another. Give each its own Address and start it with a label.

Visiting address
Kvirnby municipality
Storgatan 1
123 45 Kvirnby
Postal address
Kvirnby municipality
Registry office
Box 100
123 45 Kvirnby

Warning: Don't forget

Name each address in words, not by position or colour. Someone who hears the page read aloud gets no layout (1.3.3 Sensory Characteristics).

Who to ask about one news item

An Address inside an article is the contact for that article, not for the page.

The recycling centre has new opening hours

From 1 November the recycling centre is open until 19:00 on weekdays. On Saturdays it closes at 15:00.

Questions about this news item
Environment office
+46 70 174 06 05
contact@kvirnby.example

Accessibility#

What it does for you#

  • APG pattern: none. Address is static content, not a widget.
  • Deviations: none
  • Native elements used: <address>. No as: the element is the semantics.

Address is the native <address> element with a class, so the theme can undo the browser's italic. It adds no role, ARIA, text or behaviour. <address> has the group role in some browsers and none in others, and a screen reader reads its text as part of the page.

PartElement / roleARIANotes
Address<address> → native semanticsnoneclass="kv-address". Attributes (id, aria-*) and the ref reach the element unchanged. Links inside it are ordinary links with their own text
Addressneverno role, tabindex, nameIt needs no accessible name: a screen reader reads its content in the flow. Don't add aria-label, which address doesn't reliably expose

It announces nothing.

What you need to do#

  • Use it for contact details of the page or the article around it only (1.3.1). Other postal-looking text is plain text.
  • Say what each address is. Separate a visiting address and a postal address, with a label in words, never by position or colour alone (1.3.3).
  • Link text names the target. A tel: link has the number as its text and a mailto: link has the email address, so the link makes sense out of context (2.4.4).
  • Language. Text in another language goes in a nested KvirnProvider, with useLocale().localeProps on your own element (3.1.2).

Warning: Don't forget

Give each phone and email link the number or the address as its text. Then the link’s purpose is clear from the link and its surrounding text (2.4.4 Link Purpose, In Context).

Visual and modes#

Headless: Address ships no CSS. With @kvirn-ui/theme/theme.css, kv-address shows the address in upright text at the body text size and line height. Browsers set address in italic, and long italic text is harder to read, so the theme undoes it. Sizes are in rem (1.4.4). Target size and focus indicator belong to the links inside. Motion: none.

Focus management#

  • Initial focus: not moved. Address never moves focus.
  • Trap: no.
  • Restore to: not applicable.

WCAG success criteria#

  • 1.3.1 Info and Relationships: contact details are marked up as <address> (address.test.tsx › renders an address element…).
  • 1.4.4 Resize Text: the size is in rem.

Keyboard#

Address has no keys of its own. What you put in it keeps its own keys.

API reference#

import { Address } from '@kvirn-ui/react'

Address

Renders <address> with no role of its own. It takes every attribute of an <address> and passes ref to it. It has no state, no hook and no as, and it renders on the server too. The default theme is described on Theming.

PropTypeDefaultDescription
refRef<HTMLElement>–Reaches the <address> element.
Class or attributeValuesMeaning
kv-addressalwaysThe part class. The default theme uses it to undo the browser’s italic. Your className joins it.

Testing#

The automated tests prove the keyboard behaviour, the names and states, that axe finds no violations in every story and theme, and, for the components they cover, that the stories hold up in forced colours, reduced motion, text spacing and a 320 pixel width. An Automated row passes on these tests alone. A Core or Release row passes only when an automated agent check and a person on the real assistive technology have both checked it. "agent-verified" means automated tests in the repository (with a virtual screen reader for the screen reader rows), not the real assistive technology.

AT + browser + OSAgent checkHuman checkResultNotes
Automated (re-runnable tests)
axe, WCAG 2.2 A and AA, every story, 4 themespassn/apassaddress.stories.tsx, every story, 4 themes
Markup and ARIA (roles, names, ids, states)pendingn/apendingaddress.test.tsx has no axe check
Keyboard contract rows (Vitest browser)passn/apass2 rows, each names a test in address.test.tsx
Focus order and managementn/an/an/aAddress itself is never focusable and never moves focus; links inside are the consumer’s own Link components, each under its own contract
Display modes (forced colours, 320px reflow, text spacing, reduced motion)passn/apassthe four sweep projects (storybook-forced-colors, -reduced-motion, -reflow, -text-spacing), run in CI
Core (required for beta)
NVDA + Chrome + Windowsn/an/an/anative <address> with its own semantics; no role, state, focus or key handling; links inside are the consumer's own Link components, each under its own contract; nothing to operate
VoiceOver + Safari + iOSn/an/an/anative <address> with its own semantics; no role, state, focus or key handling; links inside are the consumer's own Link components, each under its own contract; nothing to operate
Release (before 1.0 and each minor)
JAWS + Chrome + Windowsn/an/an/anative <address> with its own semantics; no role, state, focus or key handling; links inside are the consumer's own Link components, each under its own contract; nothing to operate
TalkBack + Chrome + Androidn/an/an/anative <address> with its own semantics; no role, state, focus or key handling; links inside are the consumer's own Link components, each under its own contract; nothing to operate
VoiceOver + Safari + macOSn/an/an/anative <address> with its own semantics; no role, state, focus or key handling; links inside are the consumer's own Link components, each under its own contract; nothing to operate