PhoneInput
Phone number input with country code selector
Accessibility
- Pair the control with a visible label or aria-label and keep helper or error text programmatically associated.
- Preserve expected keyboard entry, selection, and state announcements for the chosen input pattern.
Styled quick start
Copy this entrypoint first. It includes the imports required to get the component on screen.
svelte
<script lang="ts">
import '@dryui/ui/themes/default.css';
import '@dryui/ui/themes/dark.css';
import { PhoneInput } from '@dryui/ui';
</script>
<PhoneInput bind:value={phone} defaultCountry="US" placeholder="(555) 123-4567" /> Import options
Root package
ts
import { PhoneInput } from '@dryui/ui' Per-component subpath
ts
import { PhoneInput } from '@dryui/ui/phone-input' API
Props, CSS variables, and the public data attributes you can target when styling.
| Prop | Type | Description | Default | Required | Bindable |
|---|---|---|---|---|---|
| size | smmdlg | Size preset affecting density, spacing, or typography. | 'md' | — | — |
| value | string | Current controlled or bindable value. | '' | — | ✓ |
| defaultCountry | string | — | 'US' | — | — |
| disabled | boolean | Prevents interaction and applies disabled styling. | false | — | — |
| name | string | Field name used during native form submission. | — | — | — |
| placeholder | string | Hint text shown when no value is selected or entered. | 'Phone number' | — | — |
| countries | CountryInfo[] | — | — | — | — |
| onchange | (value: string) => void | — | — | — | — |