Input

A 48 field you type in, label above.

$ npx shadcn@latest add https://mahrdesign.faizintifada.com/r/input.json

Default

48 high, fully round, label ABOVE (never floating). Helper text under the field.

Dipakai HR untuk menghubungi Anda.

States

Focus: one 2px --ring line on the edge, no halo (tweens in 150 ms) · error: the same line in a soft red + message (validate on blur and submit); focused, the red sharpens, never blue · disabled 60 % · read-only: --muted fill, no edge.

Nomor rekening BCA terdiri dari 10 angka.

Error on submit (motion)

Motion: transitions.dev 12 "Error state shake". Wrap the control in <FieldControl> and pass shakeKey (count of failed submits) to <Field>: the field shakes once per failed submit, 280 ms. The error stays until the value is fixed. Reduced motion: no shake.

Prefix, suffix, optional

"Rp" prefix with tabular numbers; the password field is PasswordInput (built on Input); search icon. Optional fields say "(tidak wajib)": required fields have no mark.

Rp
Rp

When to use

  • Short text the user TYPES: nama, telepon, email, nomor rekening, money (start="Rp").
  • Search in a toolbar (type="search", search icon at the start).

When not to use

  • More than one line (alasan, alamat) → Textarea.
  • Pick from a fixed list → Select (5+) or SegmentedControl / RadioGroup (2–4).
  • A date → DateField (typing a date is not supported).
  • A password → PasswordInput (it has the eye, aria-pressed, autoComplete and hide-on-submit). Never build an eye with Input end.

Do and don't

DoShow a real example valuePlaceholder "Sari Pratiwi" or "250.000": the user sees the format at once.
Don't"Contoh: …" or a red asteriskNever write "Contoh:" in a placeholder. Never mark required fields; mark the optional ones with "(tidak wajib)".

Installation

Add Input with the shadcn CLI (your project needs a components.json and the MaHR theme: https://mahrdesign.faizintifada.com/r/theme.json), or copy the files by hand.

terminal
bunx --bun shadcn@latest add https://mahrdesign.faizintifada.com/r/input.json

API

Input

import { Input } from "@/components/ui/input"
PropTypeDefaultDescription
size"default" | "sm""default"default 48 in forms. sm 44 in toolbars, beside 44 buttons, Select sm and SegmentedControl (one control height per surface).
startReactNode–Inside left: "Rp" or a 20 icon.
endReactNode–Inside right: an IconButton (ghost, sm).
aria-invalidboolean–Error edge. Pair with FieldError and Field invalid.
readOnlyboolean–--muted fill, no edge ("Diatur oleh HR").
type · value · onChange · disabled · inputMode …native input props–inputMode="numeric" for money and phone.

Field

import { Field, FieldControl, FieldLabel, FieldDescription, FieldError } from "@/components/ui/field"
PropTypeDefaultDescription
Field invalid · disabledboolean–Hides the description when invalid; dims the label when disabled.
Field shakeKeynumber | string–Change it on every failed submit; with invalid, the <FieldControl> shakes once (transitions.dev 12).
<FieldControl>div–Wraps Input, Textarea, Select or DateField: the element that shakes. useErrorShake(ref, invalid, key) for custom controls.
FieldLabel optionalbooleanfalseAdds "(tidak wajib)".
FieldError childrenReactNode–Render it always. Empty = closed (0 px, no space kept). A message opens the slot by height in 250 ms, so the content below slides down; fixing it closes the slot. A FieldDescription closes while the error opens. Announced by a live region (role="alert").