DEV Community

Cover image for Open-source phone input components coded with Tailwind CSS
Zoltán Szőgyényi for Themesberg

Posted on • Originally published at flowbite.com

7 3 3 3 2

Open-source phone input components coded with Tailwind CSS

Hey developers!

In this article I would like to show you a collection of open-source UI phone input UI components coded with Tailwind CSS and Flowbite that you can use to introduce phone numbers and send SMS and call messages to users for authentication and verification.

It is a very commonly used component on e-commerce websites and it can really help you validate phone numbers based on location and region.

The technologies that you need to have installed in your project are Tailwind CSS and Flowbite. You need Tailwind CSS for the utility classes and Flowbite for the JS interactivity, such as for the dropdowns when selecting the country code.

So without further ado, let me show you the examples!

Tailwind CSS Phone Input

The phone number input component from Flowbite can be used to set a phone number inside a form field by using the native type="tel" attribute and also use a dropdown menu to select the country code.

The examples are built with the utility classes from Tailwind CSS and they are fully responsive, dark mode compatible and support RTL layouts and can be used for any type of web project.

Default phone input

Use this component to set a phone number inside an input field by setting the type="tel" attribute.

Tailwind CSS Phone Input

Phone input country code

This example can be used to select the country code from a dropdown menu and set the phone number inside an input field and use the pattern attribute to validate the phone number.

Tailwind CSS Phone Input Country Code

Floating label input

Set a phone number inside an input field with a floating label inspired by Material UI from Google.

Tailwind CSS Floating Label Input

Verification code input

Use this example to send a verification code to the user’s phone number for authentication.

Tailwind CSS Phone Input Verification

Authentication form

Use this example to select one of your saved phone numbers from an application with a copy-paste feature.

Tailwind CSS Phone Authentication Form

Advanced phone verification

Use this example to verify a phone number via SMS or phone call using a dropdown component.

Tailwind CSS Advanced Phone Verification

Credits

These examples couldn't have been made without the following awesome and open-source resources:

Tiugo image

Modular, Fast, and Built for Developers

CKEditor 5 gives you full control over your editing experience. A modular architecture means you get high performance, fewer re-renders and a setup that scales with your needs.

Start now

Top comments (0)

AWS Security LIVE! Stream

Go beyond the firewall

There's more to security than code. Explore solutions, strategies, and the full story on AWS Security LIVE!

Learn More

👋 Kindness is contagious

DEV is better (more customized, reading settings like dark mode etc) when you're signed in!

Okay