Mushilu-San UI

Search components

PlaygroundStorybookGitHub
Forms

Input

A single-line text field with sizes, visual variants and an invalid state.

Selector: input[muiInput]

Import
import { Input } from '@mushilu-san/ui/forms';
PreviewCode

Loading example…

Overview

Input is applied to a native <input>, so it keeps the native role, value handling and autofill. Pair it with a <label> or a Form field.

Set invalid for the failed-validation styling. It also sets aria-invalid="true", so screen readers announce the state. Link an error message with aria-describedby.

When to use

  • Collecting a short piece of text, such as a name, email or search term.
  • Any single-line value that the user types.

When not to use

  • More than one line of text. Use a textarea. Use Textarea instead.
  • Choosing from a fixed list of values. Use a select. Use Select instead.

Examples

Sizes and variants

PreviewCode

Loading example…

Guidelines

Do

  • Always give an input a visible label. Placeholder text is not a label.
  • Use the right type (email, tel, search) so mobile keyboards match.

Don't

  • Do not use placeholder text as the only instruction.
  • Do not show an error without telling the user how to fix it.

Accessibility

Roles and attributes

ElementRoleNotes
input[muiInput]textbox (native)invalid sets data-invalid and aria-invalid="true".

Keyboard

KeysAction
TabShiftTabMoves focus to and from the field.
  • Name the field with a <label> or aria-label. Use autocomplete for personal data.

API

Input

Selector: input[muiInput]

NameTypeDefaultDescription
size'sm' | 'md' | 'lg''md' Input height and text size: `sm`, `md` or `lg`. Default `md`.
variant'ghost' | 'outline' | 'filled''outline' Visual style: `outline`, `filled` or `ghost`. Default `outline`.
invalidbooleanfalse Shows the failed-validation style and sets `data-invalid`. Also sets `aria-invalid`. Accepts attribute presence, e.g. <… invalid>.

CSS parts

  • ::part(input)

Tokens

  • --mui-color-surface
  • --mui-color-border
  • --mui-color-text
  • --mui-color-focus-ring
  • --mui-color-danger
  • --mui-touch-target