Skip to main content
161

Search Lumen

Find components, APIs, guides, and recipes.

GitHub
Web docs
Forms

PhoneInput

Combines localized country metadata, calling codes, formatting, validation, and E.164 output.

FrameworksAstro · React · Elements

Registry commandlumen add PhoneInput

InteractionNative markup

01

See it and copy it

Framework example

Choose Astro, React, or Elements to compare native usage against the shared visual output. Each example assumes the framework-level setup is already complete.

AstroSame visual contract, native framework API

Framework usage

Switch targets to compare the adapter code. The preview stays visually stable because all three packages share the same tokens and ui-* class contract.
astro
---
import { PhoneInput } from '@santi020k/lumen-astro'

const countries = [
  { label: '🇺🇸 +1', value: '+1' },
  { label: '🇬🇧 +44', value: '+44' },
  { label: '🇪🇸 +34', value: '+34' },
  { label: '🇨🇴 +57', value: '+57' },
  { label: '🇯🇵 +81', value: '+81' }
]
---

<div style="display: grid; gap: 0.75rem; max-width: 22rem;">
  <label for="ex-phone">Phone number</label>
  <PhoneInput
    countries={countries}
    countryValue="+1"
    id="ex-phone"
    name="phone"
    placeholder="(555) 000-0000"
  />

  <label for="ex-phone-sm">Small</label>
  <PhoneInput
    countries={countries}
    countryValue="+44"
    id="ex-phone-sm"
    name="phone-sm"
    placeholder="Mobile number"
    size="sm"
  />

  <label for="ex-phone-lg">Large</label>
  <PhoneInput
    countries={countries}
    countryValue="+34"
    id="ex-phone-lg"
    name="phone-lg"
    placeholder="Work number"
    size="lg"
    value="612 345 678"
  />
</div>
Edit PhoneInput in browser
02

Choose your target

Add this component

Choose the package for your runtime. All adapters share the Lumen stylesheet. Use the matching registry command when you want a local wrapper for that framework.

bash@santi020k/lumen-astro
pnpm add @santi020k/lumen-astro
pnpm add @santi020k/lumen-astro
bashAstro wrapper
lumen add PhoneInput
lumen add PhoneInput

API reference

Lumen-specific props and runtime attributes for the Astro primitive. React props follow the same names; Elements use equivalent kebab-case attributes where custom elements expose them.

AttributeValuesDefaultDescription
countriesArray<string | { label, value, disabled? }>International metadataOverrides the generated country choices for legacy or specialized forms.
countryOptionsLumenPhoneCountry[]Generated metadataOverrides localized country metadata while retaining formatting and E.164 behavior.
countryNamestring"country"Sets the name of the country dial-code select.
countryLabelstring"Country code"Sets the accessible label for the dial-code select.
countryValueISO region or calling code"US"Selects the initial country by region or calling code.
localestring | string[]Runtime localeLocalizes generated country names.
namestring"phone"Sets the name of the telephone number input.
placeholderstring"Phone number"Sets the placeholder for the number input.
value / onValueChangeLumenPhoneNumber / callbackUncontrolledControls formatted national input and exposes validity plus E.164 in React.
size"default" | "sm" | "lg""default"Controls the height and font size of both controls.
class, classNamestring""Merges custom classes with the generated ui-* root classes.
...native attributesHTML attributes-Forwards standard attributes to the root element unless the component consumes them.

Web docsFull catalog