Components
Input
Single-line text input with accessible error state
Overview
Input is a single-line text input for editing a value in place. Its border stays hidden until you hover or focus it, so it blends into cards and panels.
- States — enabled, hover, focus, disabled, invalid
- Error Message —
errorMessageshows red text below the input, marks itaria-invalid, and links the text witharia-describedby - Standard attributes —
disabled,placeholder,readOnly,aria-*and event handlers go straight to the input element
States
| State | How it looks | How to turn it on |
|---|---|---|
| enabled | No visible border | — |
| hover | Gray border (not while disabled or invalid) | Pointer over the input |
| focus | Dark 2px border instead of the blue ring | Click or Tab |
| disabled | Gray text, skipped by Tab | disabled |
| invalid | Red border; red 2px when focused | errorMessage or aria-invalid |
Error Message
errorMessage turns on the invalid state for you. Screen readers read the message after the input's name.
The input gets aria-invalid="true", and aria-describedby points at the message's generated id.
To show the red border without a message, pass aria-invalid instead. Your own aria-describedby is kept next to the error message.
Full Width
Input fills its parent by default. Pass isFullWidth={false} to size it to its content.
Props
| Prop | Type | Default | Required | Description |
|---|---|---|---|---|
isFullWidth | boolean | true | No | Width is 100% by default, so leaving it out fills the parent. false makes it auto |
errorMessage | string | - | No | Error text. When set, aria-invalid turns on and the text is linked with aria-describedby |
aria-invalid | boolean | 'true' | 'false' | - | No | Shows the error look without error text. Not needed when errorMessage is set |
disabled | boolean | false | No | Disabled (standard HTML attribute) |
value | string | - | No | Value. Passing it makes the input controlled (needs onChange); leave it out to let the browser keep the value |
onChange | (e: ChangeEvent<HTMLInputElement>) => void | - | No | Called when the value changes |
type | string | ''text'' | No | input type |
name | string | - | No | input name |
className | string | - | No | Extra CSS class |
ref | Ref<HTMLInputElement> | - | No | Ref to the input element |
Specification
base
| 상태 | 요소 | 속성 | 값 |
|---|---|---|---|
| enabled | root | color | $color.text.default.default |
| enabled | root | backgroundColor | $color.background.default.default |
| enabled | root | borderColor | $color.background.default.default |
| enabled | root | borderWidth | $size.stroke.border |
| enabled | root | borderRadius | $size.radius.100 |
| enabled | root | padding | $size.space.200 |
| enabled | root | typography | $text.bodyStrong |
| enabled | root | placeholderColor | $color.text.default.secondary |
| enabled | errorText | color | $color.text.danger.default |
| enabled | errorText | typography | $text.caption |
| enabled | errorText | marginTop | $size.space.100 |
| hover | root | borderColor | $color.border.default.default |
| focus | root | strokeWidth | $size.stroke.focus |
| focus | root | strokeColor | $color.border.brand.default |
| focus | root | outlineStyle | none토큰 아님 — the border shows focus instead |
| disabled | root | color | $color.text.disabled.default |
| invalid | root | borderColor | $color.border.danger.default |
Accessibility
- Give every input a name: a label element with
htmlFor,aria-label, oraria-labelledby. A placeholder is not a name. - Use
errorMessagerather than placing your own red text next to the input, so the message is announced. - Placeholder text uses
text.default.secondary(4.6:1 on the default background).
Guidelines
- Use
disabled, notisDisabled. UseerrorMessageoraria-invalid, notvariant="error". The old names were removed.