LocationInput
Location autocomplete input with Google Places integration.
Provides a styled input with dropdown suggestions for city or address search.
Requires Google Maps JavaScript API to be loaded with Places library.
Peer requirement:
This component statically imports @desk/location, which is **not** a
dependency of the published package — it is intentionally excluded to keep
the Google-Places geocoding stack out of consumers who don't need location
search. To use LocationInput from an installed @desk/ui,
add @desk/location to your own dependencies; without it, bundling any
module that imports LocationInput fails to resolve @desk/location.
Consumers who never import LocationInput pay nothing (per-subpath exports +
sideEffects: false). In-monorepo, @desk/location is a devDependency so
the component, its story, and tests resolve normally.
Usage
import { Location, LocationInput, LocationMode, SharedLocationInputProps } from "@desk/ui/components/location-input";Best practices
LocationInputrequires the@desk/locationpeer (a Google-Places stack deliberately excluded from the published package) — add it to your deps, or bundling any module that imports this component fails to resolve.It also needs the Google Maps JS API loaded with the Places library at runtime; without it, suggestions never populate.
Pick
mode="city"vs"address"to scope the geocoding; drive it controlled via theLocationvalue+onChange(which also fires on clear).
Props
| Prop | Type | Default | Description |
|---|---|---|---|
| size | ResponsiveValue<LocationInputSize> | "xl" | Input size — a single token or a per-breakpoint object like
|
| hasError | boolean | Show error styling | |
| testId | string |
Also exports
- interface
Location - type
LocationMode - interface
SharedLocationInputProps