Loading source
Pulling the file list, source metadata, and syntax-aware rendering for this listing.
Source from repo
Living wiki of UI design patterns and best practices built with Fumadocs, Next.js, and Base UI components.
Files
Skill
Size
Entrypoint
Format
Open file
Syntax-highlighted preview of this file as included in the skill package.
rules/ux-postels-accept-messy-input.md
1---2title: Accept Messy Input, Output Clean Data3impact: MEDIUM4tags: ux, postels, input, validation5---67## Accept Messy Input, Output Clean Data89Inputs should accept messy human data and normalize it. Validate generously, format strictly.1011**Incorrect (rigid format required):**1213```tsx14function DateInput({ onChange }) {15return (16<input17type="text"18placeholder="YYYY-MM-DD"19pattern="\d{4}-\d{2}-\d{2}"20onChange={onChange}21/>22);23}24```2526**Correct (accepts multiple formats):**2728```tsx29function DateInput({ onChange }) {30function handleChange(e) {31const parsed = parseFlexibleDate(e.target.value);32if (parsed) onChange(parsed);33}3435return (36<input37type="text"38placeholder="Any date format"39onChange={handleChange}40/>41);42}43```4445Reference: Postel, J. (1980). RFC 761 — Transmission Control Protocol.46