Skip to content
This repository has been archived by the owner on Mar 27, 2023. It is now read-only.

Support for phone number form fields #6311

Locked Answered by coryrylan
gayathrirajendran asked this question in General
Discussion options

You must be logged in to vote

Using Clarity Core you can create a tel type input

https://stackblitz.com/edit/http-server-jalzuj?file=src%2Findex.html

<cds-input validate>
  <label>Phone Number</label>
  <input type="tel" pattern="[0-9]{3}-[0-9]{3}-[0-9]{4}" required value="123-456-7890" />
  <cds-control-action action="prefix" readonly aria-label="US phone number">🇺🇸 +1</cds-control-action>
  <cds-control-message error="patternMismatch">please enter US phone number (111-222-3333)</cds-control-message>
  <cds-control-message error="valueMissing">required</cds-control-message>
</cds-input>

Replies: 1 comment 2 replies

Comment options

You must be logged in to vote
2 replies
@gayathrirajendran
Comment options

@coryrylan
Comment options

Answer selected by coryrylan
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
type: support Support, implementation or questions component: forms @cds/core
2 participants