Skip to Content
Archi-ui 1.0.25 is released 🎉

Input

Input fields allow users to enter text into a UI. They typically appear in forms and dialogs.

Basic Input

Usage

import { Input } from 'archi-ui'
<Input type="text" placeholder='Enter name' />

Variants

The Input comes with three variants: outlined(default), filled, standard.

Form props

Standard form attributes are supported, for example required, disabled, type, etc.

Helper text

Helper text

Helper text

Size

For different size of Input like small, medium, large use size prop.

Full-width

fullwidth can be used to make the input take up the full width of its container.

Color

The color prop changes the highlight color of the text field when focused.

Input Validation

The error prop toggles the error state. The FormHelperText can then be used to provide feedback to the user about the error.

Incorrect entry.

Incorrect entry.

Incorrect entry.

Helper Text

Pair the Input with FormHelperText component to add helper text for users to better understand.

Helper text

Helper Text with Error

Use error prop if you want helpertext to be displayed in an error state.

Helper text

Helper text

Helper text

FormControl

Provides context such as variant/color/size/error/required/disabled/fullwidth for form inputs. Relying on the context provides high flexibility and ensures that the state always stays consistent across the children of the FormControl.

This context is used by following components:

  • Label
  • FormHelperText
  • Input
  • PinInput
  • Textarea

Helper text

Helper text

Helper text

Uncontrolled vs. Controlled

The component can be controlled or uncontrolled.

  • A component is controlled when it’s managed by its parent using props.
  • A component is uncontrolled when it’s managed by its own local state.

Input Addornment

Use the InputGroup and InputAdornment components to add an addon to the input.

https://
.com
+91

Leading and Tailing Icons

Use the leadingIcon and tailingIcon to add icons to the start and end of the input.

$
USD

Textarea

Input API

API reference docs for the React Input componenet.

NameTypeDefaultDescription
classNamestring-Override or extend the styles applied to the component.
typestring-Type of the input element. It should be a valid HTML5 input type.
variant'filled' | 'outlined' | 'standard''outlined'The variant to use.
color'primary' | 'secondary' | 'info' | 'warning' | 'success' | 'error''primary'The color of the componenet.
fullwidthboolfalseIf true, the input will take up the full width of its container.
size'sm' | 'md' | 'lg''md'The size of the component.
autoFocusbool-If true, the input element is focused during the first mount.
defaultValueany-The default value. Use when the component is not controlled.
disabledbool-If true, the component is disabled.
errorboolfalseIf true, the input will indicate an error.
onChangefunc-Callback fired when the state is changed.
Signature:
function(event: React.changeEvent) => void. You can pull out the new value by accessing event.target.value (string).
placeholderstring-The short hint displayed in the input before the user enters a value.
readOnlybool-It prevents the user from changing the value of the field (not from interacting with the field).
requiredboolfalseIf true, the input element is required.
valueany-The value of the input element, required for a controlled component.
leadingIconnode-Icon to display at begin of an input.
tailingIconnode-Icon to display at end of an input.
Last updated on