Skip to content

Phone input

createPhoneInput binds a Telixon controller to an <input>, formatting on every keystroke while keeping the caret stable through edits, deletions, and paste.

import { ensureEngineReady } from '@telixon/core';
import { createPhoneInput } from '@telixon/web-sdk';
await ensureEngineReady();
const phone = createPhoneInput({
input: document.querySelector('#phone'),
mode: 'international',
});
phone.subscribe((state) => {
// state.value, state.region, state.validationError
});