Documentation
React Input component

Input

Retrieve text input from a user.

Usage

First of all, you need to import the Input component from the kitchn package.

import { Input } from "kitchn"

Default

Code Editor
<Input placeholder={"Placeholder..."} />

Sizes

Code Editor
<Container row gap={"small"}>
  <Container align="flex-start">
    <Input size="small" placeholder="Small" />
  </Container>

  <Container align="flex-start">
    <Input placeholder="Default" />
  </Container>

  <Container align="flex-start">
    <Input size="large" placeholder="Large" />
  </Container>
</Container>

Sizes, prefix, and suffix

Code Editor
<Container row gap={"small"}>
  <Container align="flex-start">
    <Input
      size="small"
      placeholder="Small"
      prefix={<RiArrowUpCircleLine />}
      suffix={<RiArrowUpCircleLine />}
    />
  </Container>

  <Container align="flex-start">
    <Input
      placeholder="Default"
      prefix={<RiArrowUpCircleLine />}
      suffix={<RiArrowUpCircleLine />}
    />
  </Container>

  <Container align="flex-start">
    <Input
      size="large"
      placeholder="Large"
      prefix={<RiArrowUpCircleLine />}
      suffix={<RiArrowUpCircleLine />}
    />
  </Container>
</Container>

Disabled

Code Editor
<Container row gap={"small"}>
  <Container>
    <Input placeholder="Disabled with placeholder" disabled />
  </Container>

  <Container>
    <Input value="Disabled with value" disabled />
  </Container>
</Container>

Prefix and suffix

https://.com
kitchn/
Code Editor
<Container gap={"small"} align={"flex-start"}>
  <Container>
    <Input placeholder="Default" prefix={<RiArrowUpCircleLine />} />
  </Container>

  <Container>
    <Input placeholder="Default" suffix={<RiArrowUpCircleLine />} />
  </Container>

  <Container>
    <Input placeholder="Default" prefix="https://" suffix=".com" />
  </Container>

  <Container>
    <Input
      placeholder="Default"
      prefix={<RiArrowUpCircleLine />}
      suffix={<RiArrowUpCircleLine />}
      prefixStyling={false}
      suffixStyling={false}
    />
  </Container>

  <Container>
    <Input
      placeholder="Default"
      prefix="kitchn/"
      suffix={<RiArrowUpCircleLine />}
      suffixStyling={false}
      suffixContainer={false}
    />
  </Container>
</Container>

Prefix and suffix disabled

https://.com
kitchn/
Code Editor
<Container gap={"small"} align={"flex-start"}>
  <Container>
    <Input placeholder="Default" prefix={<RiArrowUpCircleLine />} disabled />
  </Container>

  <Container>
    <Input placeholder="Default" suffix={<RiArrowUpCircleLine />} disabled />
  </Container>

  <Container>
    <Input placeholder="Default" prefix="https://" suffix=".com" disabled />
  </Container>

  <Container>
    <Input
      placeholder="Default"
      prefix={<RiArrowUpCircleLine />}
      suffix={<RiArrowUpCircleLine />}
      prefixStyling={false}
      suffixStyling={false}
      disabled
    />
  </Container>

  <Container>
    <Input
      placeholder="Default"
      prefix="kitchn/"
      suffix={<RiArrowUpCircleLine />}
      suffixStyling={false}
      suffixContainer={false}
      disabled
    />
  </Container>
</Container>

Clearable

https://
Code Editor
<Container gap={"small"} align={"flex-start"}>
  <Container>
    <Input clearable placeholder="Enter some text..." value={"hey"} />
  </Container>

  <Container>
    <Input
      clearable
      placeholder="Really really long placeholder text..."
    />
  </Container>

  <Container>
    <Input clearable disabled placeholder="Disabled" />
  </Container>

  <Container>
    <Input clearable disabled value="Disabled with value" />
  </Container>

  <Container>
    <Input clearable placeholder="Custom width" width={300} />
  </Container>

  <Container>
    <Input
      clearable
      prefix="https://"
      placeholder="tonightpass.com"
    />
  </Container>

  <Container>
    <Input
      clearable
      placeholder="Enter some text..."
      error="A valid email address is required."
    />
  </Container>
</Container>

Types

Code Editor
<Container row gap={"small"}>
  <Container>
    <Input placeholder="Default" type="danger" />
  </Container>

  <Container>
    <Input placeholder="Default" type="warning" />
  </Container>

  <Container>
    <Input placeholder="Default" type="success" />
  </Container>
</Container>

Error

Code Editor
<Container gap={"small"}>
  <Container>
    <Input
      placeholder="error@gmail.com"
      error="A valid email address is required."
    />
  </Container>

  <Container>
    <Input
      width={200}
      placeholder="wrapping-error@gmail.com"
      error="A valid email address is required so that we can verify your GitHub installation. In the event that you cannot provide a valid email address, please contact support."
    />
  </Container>

  <Container>
    <Input
      size="small"
      placeholder="small-error@gmail.com"
      error="A valid email address is required so that we can verify your GitHub installation. In the event that you cannot provide a valid email address, please contact support."
    />
  </Container>

  <Container>
    <Input
      placeholder="long-error@gmail.com"
      error="A valid email address is required so that we can verify your GitHub installation. In the event that you cannot provide a valid email address, please contact support."
    />
  </Container>

  <Container>
    <Input
      size="large"
      placeholder="large-error@gmail.com"
      error="A valid email address is required so that we can verify your GitHub installation. In the event that you cannot provide a valid email address, please contact support."
    />
  </Container>
</Container>

Label

Code Editor
<Container>
  <Input placeholder="With label" label="My label" />
</Container>

Props

NameTypeDefaultRequiredDescriptionAccepted values
placeholderstring--The placeholder of the input.-
prefixJSX.Element | string--The prefix of the input.-
suffixJSX.Element | string--The suffix of the input.-
initialValuestring--The initial value of the input.-
valuestring--The value of the input.-
disabledbooleanfalse-The status of the input (disabled or not).-
prefixStylingbooleantrue-The status of the prefix (styled or not).-
suffixStylingbooleantrue-The status of the suffix (styled or not).-
prefixContainerbooleantrue-The status of the prefix container (whether there is one or not).-
suffixContainerbooleantrue-The status of the suffix container (whether there is one or not).-
clearablebooleanfalse-The type of the input (clearable or not).-
widthnumber | string--The width of the input.-
errorstring--The error message of the input.-
readOnlybooleanfalse-The type of the input (read-only or not).-
onClearClick(event: React.MouseEvent<HTMLDivElement>) => void--The click event handler of the input's clear button.-
readOnlybooleanfalse-The type of the input (read-only or not).-
typestring--The type of the input.primary, secondary, info, success, warning, danger, light, dark
labelstring--The label of the input.-
Last updated on