Atomic Design: MOLECULE (React Functional Components)
You are creating a MOLECULE: a composition of atoms that forms a small UI pattern.
Hard rules
- Functional components only.
- Composition over configuration:
- Prefer composing atoms with children/slots.
- Keep props focused on the pattern’s essential degrees of freedom.
- State scope:
- Local UI state is allowed only when it’s intrinsic to the widget (e.g., input focus, password visibility).
- No remote fetching; no app-level orchestration.
- Accessibility:
- Ensure correct labeling relationships (
label+htmlFor,aria-describedby, error messaging).
- Ensure correct labeling relationships (
- Controlled/uncontrolled:
- Prefer controlled where it matters; if supporting both, do it intentionally and document behavior.
Output expectations
- Provide:
Component.tsxComponent.test.tsx(render + key interactions + a11y-critical attributes)Component.stories.tsx(happy path + edge states like error/disabled)
Recommended folder conventions
src/components/molecules/<ComponentName>/...
Molecule checklist
- Built from atoms
- Minimal and well-documented props
- Handles validation/error UI predictably
- No domain-specific coupling