> For the complete documentation index, see [llms.txt](https://docs.rierino.com/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.rierino.com/sdk-core-ui/components/input.md). Agents can also search and read this documentation through its [MCP server](https://docs.rierino.com/~gitbook/mcp).

# Input

A bare text input, without a border, for building your own fields.

{% code title="input/demo.tsx" %}

```tsx
import { useState } from "react";
import { Input } from "@rierino-open/core-ui";

export default function InputDemo() {
  const [code, setCode] = useState("");

  return (
    <div style={{ display: "grid", gap: 8, width: 280, fontSize: 12 }}>
      {/* Input has no border of its own: the wrapper draws one. */}
      <div style={{ display: "flex", border: "1px solid #dfebfb", borderRadius: 6 }}>
        <Input
          aria-label="Discount code"
          placeholder="Discount code"
          value={code}
          onChange={(e) => setCode(e.target.value.toUpperCase())}
        />
      </div>
      <span>Code: {code || "none"}</span>
    </div>
  );
}
```

{% endcode %}

## Usage

{% tabs %}
{% tab title="React app" %}

```tsx
import { Input } from '@rierino-open/core-ui';

<div className="Rie-CodeField">
  <Input aria-label="Discount code" value={code} onChange={(e) => setCode(e.target.value)} />
</div>
```

{% endtab %}

{% tab title="Hosted editor" %}

```jsx
import CoreUI from '@rierino-open/core-ui';
const { Input } = CoreUI;

<div className="Rie-CodeField">
  <Input aria-label="Discount code" value={code} onChange={(e) => setCode(e.target.value)} />
</div>
```

{% endtab %}
{% endtabs %}

{% hint style="info" %}
**Use TextField for most fields**

Input is the text input inside [TextField](https://docs.rierino.com/sdk-core-ui/components/text-field.md), without TextField's border, focus colours or adornments. Use it when you build your own field layout, such as an input and a button inside one border. For a normal field, use TextField.
{% endhint %}

Input renders a native `<input>` with Core UI's padding and 11px text. It grows to fill its container and has no border or background. `onChange` receives the DOM change event, and all `<input>` attributes are accepted: `type`, `name`, `placeholder`, `maxLength` and so on.

## Examples

### Inside your own field

Put Input in a flex container and draw the border on the container, so other content can sit inside the same border.

{% code title="input/with-addon.tsx" %}

```tsx
import { Button, Input } from "@rierino-open/core-ui";

export default function InputWithAddon() {
  return (
    <form
      onSubmit={(e) => e.preventDefault()}
      style={{ display: "flex", alignItems: "center", width: 320, border: "1px solid #dfebfb", borderRadius: 6, paddingRight: 4 }}
    >
      <Input aria-label="Email" type="email" name="email" placeholder="name@example.com" />
      <Button type="submit" intent="g-button" size="small">
        Subscribe
      </Button>
    </form>
  );
}
```

{% endcode %}

## Accessibility

* **Name every input**, with `aria-label` or a `<label>` pointing at it, since Input has no label of its own. A placeholder is not a label.
* Input is a native `<input>`, so keyboard editing, autofill and form submission work as usual.

## Styling

Input carries the `Rie-input` class. It sets `data-hovered`, `data-focused`, `data-focus-visible` and `data-disabled` for state styling. Its `className` is merged with the built-in classes, as a string or a function of its state. See [Styling components](https://docs.rierino.com/sdk-core-ui/foundations/styling.md).

## API reference

| Prop           | Type                                         | Default | Description                                                                                                                                                                        |
| -------------- | -------------------------------------------- | ------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `aria-label`   | `string`                                     |         | Defines a string value that labels the current element.                                                                                                                            |
| `defaultValue` | `string \| number \| readonly string[]`      |         |                                                                                                                                                                                    |
| `disabled`     | `boolean`                                    |         |                                                                                                                                                                                    |
| `name`         | `string`                                     |         |                                                                                                                                                                                    |
| `placeholder`  | `string`                                     |         |                                                                                                                                                                                    |
| `readOnly`     | `boolean`                                    |         |                                                                                                                                                                                    |
| `type`         | `React.HTMLInputTypeAttribute`               |         |                                                                                                                                                                                    |
| `value`        | `string \| number \| readonly string[]`      |         |                                                                                                                                                                                    |
| `onChange`     | `React.ChangeEventHandler<HTMLInputElement>` |         |                                                                                                                                                                                    |
| `className`    | `string \| ((state) => string)`              |         | The CSS [className](https://developer.mozilla.org/en-US/docs/Web/API/Element/className) for the element. A function may be provided to compute the class based on component state. |

Input also accepts the other props of React Aria's [Input](https://react-spectrum.adobe.com/react-aria/TextField.html#input) and every `<input>` attribute.


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation by asking a question.

Perform an HTTP GET request on the following URL with the `ask` and `goal` query parameters:

```
GET https://docs.rierino.com/sdk-core-ui/components/input.md?ask=<question>&goal=<user_goal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is what the user is ultimately trying to achieve, the reason they need the answer. Sharing it helps GitBook give you a better, more relevant answer. A goal is most helpful when it describes the outcome the user wants rather than restating the question. For example, with `ask=how do I create an API token`, a goal like `automate deployments from our CI pipeline` lets GitBook tailor the answer to that use case.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
