Extract a pattern when its behavior repeats, rather than when two elements happen to look alike. Share stable foundations such as spacing, focus styles, and animation defaults, while keeping content and composition flexible.
Look for repeated behavior
Two elements can look alike while serving very different purposes. A reusable component becomes useful when its behavior and responsibilities are stable, not just when its class names happen to match.
Start by naming what repeats. It might be a project preview, an article card, or a section reveal. A clear name helps define the boundary and exposes which details belong to the caller.
Keep the API small
Prefer a few meaningful inputs over a long list of visual switches. A blog card can receive a post and a heading level; it does not need to know whether the surrounding page is the homepage or an archive.
Keep content data separate from interaction state. That makes it easier to use the same content in a listing, a detail page, and metadata without maintaining several copies.
- Give each component a clear responsibility.
- Use types to describe content independently of its rendering.
- Add customization when a real use case needs it.
Leave room for composition
Sharing a foundation does not require every page to look identical. Spacing, content order, and surrounding layout can give a page its character while the component handles the repeated behavior.
When a component becomes difficult to explain, look at how its options interact. Sometimes a smaller primitive and two focused compositions are easier to maintain than one component with many conditional branches.