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
| property | description | type | default |
|---|---|---|---|
| variant | variant of input | filled, unstyled,outline | outline |
| fullWidth | should input span entire block | true, false | false |
| required | is input required | true, false | false |
| prefixIcon | icon by the left of the input component | React.ReactNode | null |
| suffixIcon | icon by the right of the input component | React.ReactNode | null |
| disabled | makes input inactive | true, false | false |
| inputSize | size of the input | sm, md, lg | md |
| borderRadius | controls the appearance of the borders | round, curve, square | curve |