@theredhead — Frontend Library - v1.0.0
    Preparing search index...

    Adapter for phone numbers.

    Strips whitespace from the edges and validates that the input looks like a phone number (digits, optional leading +, spaces, dashes, dots, parentheses, slashes). The value produced strips everything except digits and a leading +.

    Shows a phone prefix icon. Clicking the icon opens a tel: link.

    readonly adapter = new PhoneTextAdapter();
    // "+1 (555) 123-4567" → value "+15551234567"

    Implements

    Index

    Constructors

    Properties

    inputType: "tel"

    Optional HTML input type attribute value.

    When set, this overrides the type input on UIInput so the adapter can request the semantically correct native input type (e.g. "email", "tel", "url").

    prefixIcon: "<path d=\"M13.832 16.568a1 1 0 0 0 1.213-.303l.355-.465A2 2 0 0 1 17 15h3a2 2 0 0 1 2 2v3a2 2 0 0 1-2 2A18 18 0 0 1 2 4a2 2 0 0 1 2-2h3a2 2 0 0 1 2 2v3a2 2 0 0 1-.8 1.6l-.468.351a1 1 0 0 0-.292 1.233 14 14 0 0 0 6.392 6.384\" />" = UIIcons.Lucide.Communication.Phone

    Optional SVG icon content to display before the input.

    Should be a Lucide SVG inner-content string (e.g. UIIcons.Lucide.Text.AtSign).

    Methods

    • Called when the user clicks the prefix icon.

      Parameters

      • text: string

        Current raw text value.

      Returns void

    • Transform the raw text into the adapted value.

      Called on every input event. The result is stored in the value model and written back to the native input element, so the user sees the adapted text. The original keystrokes are preserved in the text model.

      Parameters

      • text: string

        Raw text from the input element.

      Returns string

      Adapted value string (displayed in the field and emitted via value).

    • Validate the raw text and return a result indicating whether the current input is valid.

      When present, UIInput exposes a valid signal and applies the invalid host class when validation fails.

      Parameters

      • text: string

        Raw text from the input element.

      Returns TextAdapterValidationResult

      Validation result with valid flag and error messages.