Skip to main content

Inputs

PinInput

Description

The PinInput component is a customizable UI element used for capturing multi-digit inputs, such as PIN codes or verification codes. It supports different input styles, secret mode for sensitive inputs, and validation mechanisms. This component is ideal for applications requiring secure and user-friendly PIN or code entry.

Use Case

The PinInput component is ideal for:

  • Capturing PIN codes for authentication.
  • Inputting verification codes sent via SMS or email.
  • Securely entering multi-digit passwords or access codes.

Props Table

Prop NameTypeDescriptionDefault ValueRequired
fillType"fill" | "transparent" | "outlined" | "bottom"Defines the style of the input fields."fill"No
numberOfFields4 | 5 | 6The number of input fields.4No
onValueChange(pinValue: string) => voidCallback function to be called when the PIN value changes.undefinedYes
valuestringThe current value of the PIN input.""Yes
labelstringThe label to be displayed above the input fields.""No
labelPosition'center' | 'start' | 'end'The alignment of the label.'start'No
validations((...args: unknown[]) => void)[]Array of validation functions to validate the PIN value.undefinedNo
secretbooleanWhether to hide the input values (e.g., for PIN or password entry).falseNo

Example Use Case

Example 1: Basic PIN Input

A basic PIN input with 4 fields.

<PinInput
value="1234"
onValueChange={(pin) => console.log(pin)}
/>

SearchInput

Description

The SearchInput component is a versatile and customizable UI element used for search functionality. It supports different input styles, auto-search capabilities, and can display suggestions based on the input. This component can be used to enhance the user experience by providing real-time search results and suggestions.

Use Case

The SearchInput component is ideal for:

  • Implementing search functionality in applications.
  • Providing a search bar with real-time suggestions.
  • Creating dropdown search inputs for selecting from a list of options.

Props Table

Prop NameTypeDescriptionDefault ValueRequired
type"default" | "outline" | "shadow"Defines the style of the search input container."default"No
resultsStyleType"default" | "outline" | "alternative-fill"Defines the style of the search results container.undefinedNo
inputType"search" | "dropdown"Defines the type of the input, whether it's a search or dropdown."search"No
searchStringstringThe initial search string value.""No
labelstringThe label to be displayed above the search input.undefinedNo
autoSearchbooleanWhether to perform the search automatically as the user types.falseNo
suggestionsbooleanWhether to display search suggestions.trueNo
handleSearch(value: string) => voidCallback function to handle the search action.undefinedNo
datasetT[]The dataset to be used for displaying search suggestions.undefinedNo
renderItem(item: T, index: number) => React.JSX.ElementFunction to render each item in the search suggestions list.undefinedNo
placeholderstringThe placeholder text for the search input.""No
onValueChange(value: string) => voidCallback function to be called when the input value changes.undefinedNo

Example Use Case

Example 1: Basic Search Input

A basic search input with a search button.

<SearchInput
placeholder="Search..."
handleSearch={(value) => console.log("Search for:", value)}
/>

Slider

Description

The Slider component is a customizable UI element used for selecting a value from a range. It supports different styles, customizable colors, and can display the selected value as a percentage. This component is ideal for applications requiring user input for adjustable settings or preferences.

Use Case

The Slider component is ideal for:

  • Adjusting settings such as volume, brightness, or other preferences.
  • Selecting a value from a range in forms or settings pages.
  • Providing a visual representation of progress or value selection.

Props Table

Prop NameTypeDescriptionDefault ValueRequired
type"slide" | "progress"Defines the style of the slider."slide"No
onChange(event: React.ChangeEvent<HTMLInputElement>) => voidCallback function to be called when the slider value changes.undefinedNo
valuenumberThe current value of the slider.0Yes
showPercentagebooleanWhether to display the value as a percentage next to the slider.falseNo
labelstringThe label to be displayed above the slider.undefinedNo
progressColorstringThe color of the progress bar in the slider.color?.accent100No
backgroundColorstringThe background color of the slider.color?.foregroundInverse300No

Example Use Case

Example 1: Basic Slider

A basic slider to adjust a value.

<Slider
value={50}
onChange={(e) => console.log(e.target.value)}
/>

TextArea

Description

The Textarea component is a customizable and versatile UI element used for capturing multi-line text input. It supports different styles, labels, validation messages, and placeholders. This component is ideal for forms or any other input scenarios where users need to enter longer text.

Use Case

The Textarea component is ideal for:

  • Capturing user input in forms.
  • Providing an area for comments or feedback.
  • Allowing multi-line text entry in applications.

Props Table

Prop NameTypeDescriptionDefault ValueRequired
type"fill" | "outlined" | "outline-only"Defines the style of the textarea."fill"No
labelstringThe label to be displayed above the textarea.undefinedNo
errorMessagestringThe error message to be displayed if validation fails.undefinedNo
placeholderstringThe placeholder text for the textarea."Enter your text"No
onChange(event: React.ChangeEvent<HTMLTextAreaElement>) => voidCallback function to be called when the textarea value changes.undefinedNo
valuestringThe current value of the textarea.""No
validations((...args: unknown[]) => void)[]Array of validation functions to validate the textarea value.undefinedNo

Example Use Case

Example 1: Basic Textarea

A basic textarea for user input.

<Textarea
placeholder="Enter your comments"
onChange={(e) => console.log(e.target.value)}
value=""
/>

TextInput