121
GitHub
Forms

PhoneInput

Pairs a country dial-code select with a telephone number input.

FrameworksAstro Β· React Β· Elements

Registry commandlumen add PhoneInput

InteractionNative markup

01

See it in context

Preview

02

Copy a working example

Usage

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>
---
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>
03

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? }>[]Populates the country dial-code select options.
countryNamestring"country"Sets the name of the country dial-code select.
countryLabelstring"Country code"Sets the accessible label for the dial-code select.
countryValuestring-Selects the initial dial code by value.
namestring"phone"Sets the name of the telephone number input.
placeholderstring"Phone number"Sets the placeholder for the number input.
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.