Input

This component extends the input HTML element. Use Input to receive user's input (no pun intended)

Usage

This demo is not perfect because theming is off and still a work in progress

Import the Input component from @avocado-ui/react and render like so

You get an uncontrolled input by default so you'll need to handle input state the way you desire

Shape

The Input component can be in one of 3 shapes - round, curve and square. Use the shape prop to specified the desired border shape.

With Label Text

It's great practice to include label text on controls so information can be available to user's at all times. Avocado provides a labelText prop that shows a string at the top of the control. Here's an example...

Input Size

The Input comes in 3 sizes - sm, md and lg respectively. Set the desired size with the size prop.

Input Variant

You can set the type of the Input with the variant prop. Set it to unstyled, solid or outline to get the desired Input type.

Input With Icon

The Input component is commonly paired with icons. You can do this with the prefixIcon and suffixIcon prop. You'll have to set this to a React.ReactNode component, but it's more advisable to use an icon. Here's it working with feather icons.

Disabled Input

A disabled Input does not respond to user's actions - hover, focus, etc and shows a not-allowed cursor.

Props Table

propertydescriptiontypedefault
variantvariant of inputfilled, unstyled,outlineoutline
fullWidthshould input span entire blocktrue, falsefalse
requiredis input requiredtrue, falsefalse
prefixIconicon by the left of the input componentReact.ReactNodenull
suffixIconicon by the right of the input componentReact.ReactNodenull
disabledmakes input inactivetrue, falsefalse
inputSizesize of the inputsm, md, lgmd
borderRadiuscontrols the appearance of the bordersround, curve, squarecurve