Skip to content

Selection and input

Phone input

International phone entry with a country selector. Exports PHONE_COUNTRIES alongside it.
Available
Ports as-is

Examples

Rendered live from the maintained Storybook story. Lantern stores only the story id and embeds Storybook rather than duplicating the component or its demo.

Phone input

Rendered live from Storybook

Storybook must be running for this to load — bun run start:storybook from the monorepo root, or set NEXT_PUBLIC_STORYBOOK_URL to a deployed instance.

Props

The component's public API, read from its TypeScript source. Descriptions come from TSDoc on the prop, so this table cannot drift from the component.

PropTypeDefaultDescription
value*string—Undocumented — add TSDoc to the prop in the library.
onChange*(value: string) => void—Undocumented — add TSDoc to the prop in the library.
onCountryCodeChange(code: string) => void—Undocumented — add TSDoc to the prop in the library.
onCountryChange(country: PhoneCountry) => void—Fires alongside `onCountryCodeChange` with the whole record, so callers can keep the ISO without re-deriving it from an ambiguous dial code.
countriesPhoneCountry[]PHONE_COUNTRIESThe selectable list. Defaults to {@link PHONE_COUNTRIES}; pass a short list to scope the field to the markets a space actually sells into.
initialCountryIsostring—ISO of the country selected on first render. Replaces the app's IP lookup — the caller decides, the component never guesses. Falls back to the first entry in `countries`.
countryIsostring—Fully controlled selection. When set, the component renders this country and never tracks its own.
defaultOpenbooleanfalseMenu open on first render. Lets the open menu be a static story instead of a click path.
openboolean—Fully controlled menu state. Pair with `onOpenChange`.
onOpenChange(open: boolean) => void—Undocumented — add TSDoc to the prop in the library.
disablePortalbooleanfalseRender the menu inline instead of portalling it to `document.body`. The portal exists because absolute positioning gets clipped by scrolling ancestors in the app; docs pages want it in flow.
idstring—Put on the inner <input> so a sibling <label htmlFor> targets the field the buyer actually types into, not the country button.
placeholderstring"Mobile number"Defaults to "Mobile number" — override where a visible label already says that, so the placeholder can show an example number instead.
disabledbooleanfalseUndocumented — add TSDoc to the prop in the library.
classNamestring—Override the field container (e.g. radius/height/background) to match a surrounding form. Merged over the defaults.
inputClassNamestring—Override the inner text input (e.g. text size/placeholder colour) to match a surrounding form. Merged over the defaults.

Reference

Transcribed from the component audit. If this disagrees with the source, the source is right.

Source
src/components/auth/PhoneInput.tsx
Portability
Copies across unchanged — only the utils import path moves.