Input

A single-line text input. Inside a Field it picks up its id, description, error and required state automatically.

StableSource

Import

tsx
import { Input } from "@merid/react";

Examples

Sizes

sm 36px, md 46px (default), lg 50px.

Leading and trailing

leading and trailing add decorative icons, prefixes or units inside the frame. They are aria-hidden, so put anything meaningful (like a currency) in the label too. When either is set, the input is wrapped in .mrd-input-group and className moves to the wrapper.

Invalid, disabled, read-only

invalid forces the invalid style and aria-invalid; inside a Field it follows the Field's error. disabled and readOnly are the native attributes.

Controlled

Input is a plain <input>: use value + onChange to control it, or defaultValue to leave it uncontrolled.

meridui.dev/…

API reference

Input forwards its ref to the <input> and passes every other native input attribute through. className and style always go on the root element: the <input> itself, or the .mrd-input-group wrapper when leading or trailing is set. type defaults to "text".

PropTypeDefaultDescription
size"sm" | "md" | "lg""md"Height: sm 36px, md 46px, lg 50px.
invalidboolean–Forces the invalid style (`data-invalid`) and `aria-invalid`. Inside a Field, derived from its error.
leadingReactNode–Decorative element before the text (icon, prefix).
trailingReactNode–Decorative element after the text (icon, unit).
typestring"text"Native input type.

Styling

HookValues
.mrd-inputThe <input>
.mrd-input-groupWrapper, only when leading or trailing is set
.mrd-input-group__addonAddon slot, with data-side leading · trailing
data-sizesm · md · lg (on input and group)
data-invalidPresent when invalid; drives the danger border (aria-invalid carries the semantics)

Component variable: --mrd-input-height, set per size.

css
.filters .mrd-input {
  --mrd-input-height: 40px;
}

Accessibility

  • Every input needs a name: a visible Label / Field, or aria-label when the purpose is obvious from context (like search).
  • Placeholder text is not a label; it disappears when typing and has low contrast.
KeyAction
TabMoves focus to the input.

Guidelines

Do

Match the input size to neighbouring buttons so a row shares one height.

Avoid

Put interactive elements like buttons in leading or trailing — addons are hidden from assistive tech.