Meet Frontfriend.Your brand. Your rules. Your agents, connected.Explore what’s new
DocumentationPhoneinput

Phoneinput

Displays a input field or a component that looks like an input field along with select field for country code.

Interactive preview

Rendered from the shared Frontfriend stories with React Base, the same preview Studio shows. Styling comes from your Design System; the code below is native to Reka UI.

Installation

Complete project setup first. Your configuration must select vue/reka and include your Design System ID.

pnpm exec frontfriend download phone-input -f vue --primitive reka

Review dependencies reported by the downloader and keep your source changes in version control.

Usage

<script setup lang="ts">
import { PhoneInput } from "@/components/ui/phone-input";
import { reactive } from "vue";

const args = reactive(
  {
    "disabled": false,
    "flags": true,
    "flagsPosition": "all",
    "value": "+393331234567",
  } satisfies Partial<
    InstanceType<typeof PhoneInput> extends { $props: infer Props } ? Props : {}
  > &
    Record<string, unknown> & { flagsPosition?: "all" | "popoverOnly" },
);
</script>

<template>
  <PhoneInput v-model="args.value" :disabled="args.disabled" />
</template>

Props API

PropTypeRequiredDescription
countrystringNo
countryNamestringNo
valuestringNo
countryCodeCountryCodeNo
placeholderstringNo
preferredCountriesCountryCode[]No
ignoredCountriesCountryCode[]No
onlyCountriesCountryCode[]No
translationsPartial<Translations>No
noUseBrowserLocalebooleanNo
fetchCountrybooleanNo
noCountrySelectorbooleanNo
customCountriesListRecord<CountryCode, string>No
autoFormatbooleanNo
noFormattingAsYouTypebooleanNo
countryLocalestringNo
selectorComponentReact.ReactNodeNo
inputComponentReact.ReactNodeNo
onValueChange(value: string) => voidNo
onCountryCodeChange(countryCode?: CountryCode) => voidNo
onUpdate(results: Results) => voidNo
defaultValuestringNo
disabledbooleanNo
flagsbooleanNo
flagsPosition"all" | "popoverOnly"No

Subcomponents

  • FlagComponent
  • PhoneInputWrapper
  • PhoneInput

Examples

Default

<script setup lang="ts">
import { PhoneInput } from "@/components/ui/phone-input";

const args = {
  "disabled": false,
  "flags": true,
  "flagsPosition": "all",
} satisfies Partial<
  InstanceType<typeof PhoneInput> extends { $props: infer Props } ? Props : {}
> &
  Record<string, unknown> & { flagsPosition?: "all" | "popoverOnly" };
</script>

<template>
  <PhoneInput v-bind="args" />
</template>

With Value

<script setup lang="ts">
import { PhoneInput } from "@/components/ui/phone-input";
import { reactive } from "vue";

const args = reactive(
  {
    "disabled": false,
    "flags": true,
    "flagsPosition": "all",
    "value": "+393331234567",
  } satisfies Partial<
    InstanceType<typeof PhoneInput> extends { $props: infer Props } ? Props : {}
  > &
    Record<string, unknown> & { flagsPosition?: "all" | "popoverOnly" },
);
</script>

<template>
  <PhoneInput v-model="args.value" />
</template>

Disabled

<script setup lang="ts">
import { PhoneInput } from "@/components/ui/phone-input";

const args = {
  "disabled": true,
  "flags": true,
  "flagsPosition": "all",
} satisfies Partial<
  InstanceType<typeof PhoneInput> extends { $props: infer Props } ? Props : {}
> &
  Record<string, unknown> & { flagsPosition?: "all" | "popoverOnly" };
</script>

<template>
  <PhoneInput v-bind="args" />
</template>

Default Country

<script setup lang="ts">
import { PhoneInput } from "@/components/ui/phone-input";

const args = {
  "disabled": false,
  "flags": true,
  "flagsPosition": "all",
} satisfies Partial<
  InstanceType<typeof PhoneInput> extends { $props: infer Props } ? Props : {}
> &
  Record<string, unknown> & { flagsPosition?: "all" | "popoverOnly" };
</script>

<template>
  <PhoneInput country-code="US" />
</template>

Flags In Popover

<script setup lang="ts">
import { PhoneInput } from "@/components/ui/phone-input";

const args = {
  "disabled": false,
  "flags": true,
  "flagsPosition": "popoverOnly",
} satisfies Partial<
  InstanceType<typeof PhoneInput> extends { $props: infer Props } ? Props : {}
> &
  Record<string, unknown> & { flagsPosition?: "all" | "popoverOnly" };
</script>

<template>
  <PhoneInput v-bind="args" />
</template>

API reference

Frontfriend-owned props. Native HTML and inherited primitive props remain documented by Reka UI.

FlagComponent

Prop Type Default Description
country string —
countryName string —

PhoneInput

Prop Type Default Description
class HTMLAttributes["class"] —
countryCode CountryCode —
defaultCountry CountryCode —
defaultValue string —
disabled boolean —
flags boolean —
flagsPosition "all" | "popoverOnly" —
modelValue string —

PhoneInputWrapper

Prop Type Default Description
autoFormat boolean —
countryCode CountryCode —
countryLocale string —
customCountriesList Record<CountryCode, string> —
defaultCountry CountryCode —
defaultValue string —
excludeSelectors string[] —
ignoredCountries CountryCode[] —
modelValue string —
noCountrySelector boolean —
noFormattingAsYouType boolean —
onlyCountries CountryCode[] —
placeholder string —
preferredCountries CountryCode[] —
translations Partial<Translations> —

Configuration determines the actual classes and available styling hooks. See Theming & component configuration before introducing a repeated local override.