No Preview

Sorry, but you either have no stories or none are selected somehow.

If the problem persists, check the browser console, or the terminal you've run Storybook from.

The component failed to render properly, likely due to a configuration issue in Storybook. Here are some common causes and how you can address them:

  1. Missing Context/Providers: You can use decorators to supply specific contexts or providers, which are sometimes necessary for components to render correctly. For detailed instructions on using decorators, please visit the Decorators documentation.
  2. Misconfigured Webpack or Vite: Verify that Storybook picks up all necessary settings for loaders, plugins, and other relevant parameters. You can find step-by-step guides for configuring Webpack or Vite with Storybook.
  3. Missing Environment Variables: Your Storybook may require specific environment variables to function as intended. You can set up custom environment variables as outlined in the Environment Variables documentation.

Input

Used for regular text input. For an array of data or tree-structured data, consider using Select or Cascader respectively.

Prefix and suffix

To add more context to the input you can add either text or an icon before or after the input. You can use the prefix and suffix props for this. Try some examples in the Preview!

<Input prefix={<Icon name="search" />} />

Usage in forms with Field

Input should be used with the Field component to get labels and descriptions. It can also be used for validation by using the required attribute. See the Field component for more information.

<Field label="Important information" description="This information is very important, so you really need to fill it in"> <Input name="importantInput" required /> </Field>

Props

NameDescriptionDefault
width
Sets the width to a multiple of 8px. Should only be used with inline forms. Setting width of the container is preferred in other cases.
number
-
prefix
Show an icon as a prefix in the input
ReactNode
-
invalid
Show an invalid state around the input
boolean
-
suffix
Show an icon as a suffix in the input
ReactNode
-
loading
Show a loading indicator as a suffix in the input
boolean
-
addonBefore
Add a component as an addon before the input
ReactNode
-
addonAfter
Add a component as an addon after the input
ReactNode
-