Skip to content
← Inventory

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

  • LocationInput requires the @desk/location peer (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 the Location value + onChange (which also fires on clear).

Props

PropTypeDefaultDescription
sizeResponsiveValue<LocationInputSize>"xl"

Input size — a single token or a per-breakpoint object like { base: "sm", md: "lg" }. Matches DEFAULT_INPUT_SIZE so LocationInput lines up with Input/Button at the same size.

hasErrorboolean

Show error styling

testIdstring

Also exports

  • interfaceLocation
  • typeLocationMode
  • interfaceSharedLocationInputProps

Composition

Builds on

Icon, MenuItem