AddressInput

A labelled group for capturing a postal address: a <div role="group"> named by label, holding the consumer's own fields, each with its autocomplete token so browsers, password managers and platform autofill can fill them from the user's saved addresses.

Status: beta — implemented and unit-tested in all seven frameworks with an axe-clean demo page; not yet exercised in composed flows.

Address shapes are national: the order runs largest to smallest in Japan, China and Korea and smallest to largest in most of Europe and the Americas; some countries have no postal code, others no street names. So the component decides no fields: put one <textarea autocomplete="street-address"> inside it, which suits every country, or the structured fields the address's country uses, in that country's order. Postcode lookup and suggestion dropdowns are the consumer's; for typeahead, compose with Autosuggest or Combobox inside the group.

It is the one -input component whose root is not an <input> (an exception to the suffix table): an address is several values, and one <input> cannot hold a structured address.

Example

Show demo markup
<div class="address-input" role="group" aria-label="Delivery address"><label class="label" for="demo-street">Street</label><input id="demo-street" autocomplete="address-line1" /><label class="label" for="demo-town">Town or city</label><input id="demo-town" autocomplete="address-level2" /><label class="label" for="demo-postcode">Postal code</label><input id="demo-postcode" autocomplete="postal-code" /></div>
Usage example
<AddressInput label="Delivery address">
  <label for="street">Street</label>
  <input
    id="street"
    autocomplete="address-line1"
  />
  <label for="town">Town or city</label>
  <input
    id="town"
    autocomplete="address-level2"
  />
  <label for="postcode">Postal code</label>
  <input
    id="postcode"
    autocomplete="postal-code"
  />
</AddressInput>
Show Svelte source
// In your Svelte component:
import AddressInput from "lily-design-system-svelte-headless/components/AddressInput/AddressInput.svelte";

<AddressInput>
  <!-- content -->
</AddressInput>

Usage

<AddressInput label="Delivery address">
  <label for="street">Street</label>
  <input
    id="street"
    autocomplete="address-line1"
  />
  <label for="town">Town or city</label>
  <input
    id="town"
    autocomplete="address-level2"
  />
  <label for="postcode">Postal code</label>
  <input
    id="postcode"
    autocomplete="postal-code"
  />
</AddressInput>

Props

Prop Type Default Description
label string (required) — The group's accessible name, on aria-label
children slot (required) — The labelled address fields
...restProps HTML attributes — Spread onto the root <div>

Keyboard Interactions

  • None of its own: Tab moves through the consumer's fields, which keep native input behaviour

ARIA

  • role="group" and aria-label (from label) name the set of fields, announced as the user enters it
  • Each field has its own visible <label>; the consumer sets aria-invalid and aria-errormessage on a field that fails validation

When to Use

  • Capturing a postal address as part of a contact or delivery form, in one field or several
  • Building a postcode lookup widget where the consumer wires the lookup logic externally

When Not to Use

  • Use PostalCodeInput alone when only a postal code is needed
  • Use Combobox or Autosuggest when you want a typeahead dropdown of results

Headless

This headless component renders semantic HTML with appropriate ARIA wiring. The consumer provides all visual styling — no CSS, animations, or layout assumptions are baked in.

Styles

The component renders with .address-input as the root class. No default styles are included.

Related components

  • text-input — single-line text input without address-specific autocomplete
  • autosuggest — text input with proposed matching options
  • postal-code-input — postal/ZIP code input with format validation

Known limitations

None known.

References


Lily™ and Lily Design System™ are trademarks.

Implementation Notes

  • Renders a <div role="group"> named by label through aria-label
  • The consumer supplies the fields as children, each with its own <label> and autocomplete token (street-address, address-line1, address-level2, postal-code, country-name, …)
  • No value of its own: each field is a form control, so the form submits and resets them
  • Spreads restProps onto the root <div>
  • All text content (the group label, the field labels, error messages) comes from the consumer

Canonical contract

Generated from this component's canonical metadata — the machine-checked source the implementations are held to.

Metadata

  • Component: address-input
  • PascalCase: AddressInput
  • Description: an input for searching or manually entering an address
  • Purpose: Collects a postal address as one named group of fields, so autofill and screen readers treat it as one answer.
  • Status: beta — implemented and unit-tested in all seven frameworks with an axe-clean demo page; not yet exercised in composed flows
  • HTML tag: <div> with role="group"
  • CSS class: .address-input
  • Interactive: yes

ARIA

  • role="group" + aria-label (from label) names the set of fields
  • Each field has its own visible <label>; the consumer sets aria-invalid and aria-errormessage on a field that fails validation

Keyboard

  • No keyboard interactions of its own; Tab moves through the consumer's fields

Props

  • label: string (required) (default: —) — The group's accessible name, on aria-label
  • children: slot (required) (default: —) — The labelled address fields
  • ...restProps: HTML attributes (default: —) — Spread onto the root <div>

Markdown

This page as Markdown, for people and AI tools: address-input.md