Skip to main content

Adaptive Input

StorybookView in Storybook

Explore interactive examples and all component variations in our Storybook.

The AdaptiveInput component is an enhanced input field that supports left and right icons, input masking, and automatic formatting. It's perfect for phone numbers, credit cards, and other formatted inputs.

Basic Usage

With Icons

With Masks

Both Icons

Different Sizes

Properties

AdaptiveInput

PropertyTypeDescription
leftIconReact.ReactNodeIcon to display on the left side of the input.
rightIconReact.ReactNodeIcon to display on the right side of the input.
maskstringInput mask pattern. Use 0 for digits, other characters are treated as literals.
sizing"sm" | "md" | "lg" | "xl" | "2xl"Size of the input field.
placeholderstringPlaceholder text for the input.
typestringHTML input type (text, email, password, etc.).
disabledbooleanIf true, the input is disabled.
classNamestringAdditional CSS classes.

All other props from the base Input component are also supported.

Mask Patterns

The mask prop uses a simple pattern where:

  • 0 represents a digit placeholder
  • Other characters are treated as literals

Common Mask Examples

PatternExampleUse Case
(000) 000-0000(555) 123-4567US Phone Number
+00 0000-0000+1 5551-2345International Phone
0000 0000 0000 00001234 5678 9012 3456Credit Card
00/00/000012/25/2024Date
00000-00012345-678ZIP Code

Customization

You can customize the appearance of the AdaptiveInput using CSS classes or Tailwind CSS.

The AdaptiveInput component extends the base Input component with additional functionality for icons and masking, making it perfect for forms that require formatted input fields.