Takes one line of text.
import { Input } from "@usememos/ui";
import { Search } from "lucide-react";
<Input prefix={<Search />} placeholder="Search notes" aria-label="Search notes" />interface InputProps extends Omit<BaseInput.Props, "size" | "prefix"> {
size?: "sm" | "md";
prefix?: React.ReactNode; // says what the field is: a search or link icon
suffix?: React.ReactNode; // one action on the value (copy, clear), or a unit
className?: string; // on the visible box, not the <input>
style?: React.CSSProperties; // on the visible box, not the <input>
}
function inputClasses(options?: { size?: "sm" | "md" }): string; // the visible boxWraps Base UI's Input, so inside a Field it gets its label, description and validity. The ref and every other prop (value, onValueChange, type, disabled, native attributes) go to the <input>. The visible box is a <span> around it that fills its container's width.
- Provide a
Field.Labeloraria-label. Never a placeholder alone. prefixandsuffixhold an icon, a short word or a small ghost Button.smfor filters inside panels,mdeverywhere else.- An app's own one-line field, such as a tag input around a native
<input>, takesinputClasses()on its box: typing focus keeps the edge unchanged, andaria-invalid="true"oraria-disabled="true"on the box show those states. See Class functions.
- Enabled fields use flat
surfacewith a quiet 1pxedgeborder. A gray well is reserved for the disabled state. - Typed text weight 400; placeholder
text-secondary. Typed text follows the size row on every input device: 13px at sm and 14px at md. - Hover, focus and press keep the same
edgeborder andsurfacefill. The caret or text selection indicates typing focus; there is no focus border change, ring or animation. Invalid fields retain theirdangeredge while focused. Disabled fields usewell, a quietedgeandtext-disabledtext. Forced colors uses a 2px system focus edge. See boundary contrast for the resting edge's contrast tradeoff. - The side with a prefix or suffix has 2px less padding.