Simplicity vs Flexibility: Designing a scalable dropdown for a UI System
“Keep it simple.”
We all agree with it — until simplicity starts slowing us down.
On a previous project, I shipped a reusable dropdown component for a shared design system built with React and TypeScript. Most of the team liked it.
One senior engineer didn’t.
“This is over-engineered. Why not just stick to one pattern?”
Fair question.
But also… an incomplete one.
This post is not a counter-argument. It’s a case study in trade-offs—and what simplicity actually means at scale.
We weren’t building a one-off dropdown.
We were building a primitive design system:
- Used across multiple applications
- Consumed by developers with different experience levels
- Required to scale with evolving product needs
- Expected to reduce duplication and accelerate delivery
This translated into real constraints:
| Requirement | Why it mattered |
|---|---|
| Ease of use | Teams should implement it in minutes |
| Flexibility | Handle edge cases without rewrites |
| Consistency | Align with design system standards |
| Scalability | Avoid fragmentation across apps |
Without a flexible primitive, each team eventually builds their own dropdown variant. We'd seen it happen: four applications, four slightly different dropdown implementations, zero shared behavior, and a design audit that was a disaster. The hybrid approach wasn't about cleverness — it was about preventing that outcome before it happened.
Local simplicity vs system-wide flexibility
Instead of committing to a single pattern, I made a deliberate call.
The call: A hybrid architecture — Compound Components + Render Props
Because each pattern solves a different class of problems:
| Pattern | Strength |
|---|---|
| Compound Components | Declarative, composable, design-system friendly |
| Render Props | Fast, minimal setup, dynamic usage |
This isn't a novel idea — it's industry-validated
The most mature headless UI libraries in the React ecosystem all converge on compound component APIs as their primary pattern:
- Radix UI —
DropdownMenu.Root,DropdownMenu.Trigger,DropdownMenu.Content - Headless UI —
Menu,Menu.Button,Menu.Items,Menu.Item - React Aria —
MenuTrigger,Button,Popover,Menu,MenuItem - Chakra UI —
Menu,MenuButton,MenuList,MenuItem
The compound model dominates because it gives consumers control over structure without exposing implementation internals. The render props path complements it by lowering the barrier to entry for simpler use cases.
Having two API surfaces doesn't double the complexity — it provides an escape hatch. Developers start on the fast path. When requirements outgrow it, they migrate to the compound model without touching the underlying behavior. This is the same principle React itself applies: useReducer is the escape hatch from useState, not a replacement for it.
The goal wasn’t to be clever—it was to scale developer experience across teams.
<Dropdown
renderTrigger={(open) => (
<button>{open ? "Close": "Open"} Menu</button>)}
items={[
{ label:"Edit", onClick: handleEdit },
{ label:"Delete", onClick: handleDelete },
]}
/>What this buys you:
- Minimal setup
- Ideal for dashboards, internal tools
- No need to learn internal structure
<Dropdown>
<Dropdown.Trigger>
<button>Options</button>
</Dropdown.Trigger>
<Dropdown.Menu>
<Dropdown.Item onClick={handleEdit}>Edit</Dropdown.Item>
<Dropdown.Separator/>
<Dropdown.Item onClick={handleDelete}>Delete</Dropdown.Item>
</Dropdown.Menu>
</Dropdown>This gives you:
- Full composability
- Aligns with design system patterns
- Supports complex UI scenarios
At its core, the component centralizes behavior and exposes two rendering strategies:
interface DropdownContextValue {
open: boolean;
toggle: () => void;
close: () => void;
}
interface DropdownProps {
children?: React.ReactNode;
renderTrigger?: (open: boolean) => React.ReactNode;
items?: DropdownItem[];
}
const DropdownContext = React.createContext<DropdownContextValue | null>(null);
export const useDropdown = (): DropdownContextValue => {
const ctx = React.useContext(DropdownContext);
if (!ctx) throw new Error("useDropdown must be used inside <Dropdown>");
return ctx;
};
export const Dropdown = ({ children, renderTrigger, items }: DropdownProps) => {
const [open, setOpen] = useState(false);
const containerRef = useRef<HTMLDivElement>(null);
const toggle = useCallback(() => setOpen((prev) => !prev), []);
const close = useCallback(() => setOpen(false), []);
// Click-outside handler
useEffect(() => {
const handleClickOutside = (e: MouseEvent) => {
if (containerRef.current && !containerRef.current.contains(e.target as Node)) {
close();
}
};
if (open) document.addEventListener("mousedown", handleClickOutside);
return () => document.removeEventListener("mousedown", handleClickOutside);
}, [open, close]);
const contextValue: DropdownContextValue = { open, toggle, close };
// Render props mode
if (renderTrigger && items) {
return (
<div ref={containerRef}>
{renderTrigger(open)}
{open && (
<ul role="menu">
{items.map((item, i) => (
<li
key={i}
role="menuitem"
onClick={() => { item.onClick(); close(); }}
>
{item.label}
</li>
))}
</ul>
)}
</div>
);
}
// Compound mode
return (
<DropdownContext.Provider value={contextValue}>
<div ref={containerRef}>{children}</div>
</DropdownContext.Provider>
);
};This is where the trade-offs become real.
Let’s be honest:
- Higher cognitive load
- Two APIs to maintain
- Potential inconsistency across teams
- Larger surface area for bugs
And the strongest critique:
“We should optimize for simplicity first.”
That argument is valid—but incomplete.
A single-pattern approach optimizes for Local simplicity. The hybrid approach optimizes for System-wide simplicity.
| Type | Meaning |
|---|---|
| Local Simplicity | Easy to understand in isolation |
| System Simplicity | Easy to use across many scenarios |
There's a type of simplicity that only surfaces months after shipping: how easy is it to update, extend, or deprecate? A single-pattern approach can be locally simple and still be operationally complex if every change requires downstream updates across multiple apps. The hybrid model centralizes behavior in one place — DropdownContext and useDropdown — so behavioral updates propagate everywhere without touching consumer code.
Scenario A — Only Compound Components
<Dropdown>
<Dropdown.Trigger>...</Dropdown.Trigger>
<Dropdown.Menu>...</Dropdown.Menu>
</Dropdown>Outcome:
- More boilerplate
- Slower iteration
- Repeated patterns across teams
Scenario B — Only Render Props
<Dropdown
renderTrigger={...}
items={[...]}
renderItem={...}
{...}
/>You lose:
- Composability
- Design system enforcement
- Fine-grained UI control
Imagine you need to add a confirmation step before a destructive item fires — an "Are you sure?" inline state. With render props, you'd have to add renderItem, onBeforeAction, or some custom prop to the root. Each new edge case balloons the API. With compound components, you wrap Dropdown.Item in your own component that handles the local state. The root stays clean.
A design system component is not just a component.
It’s an interface for multiple developers with different needs.
And good interfaces:
- Scale across use cases
- Reduce decision fatigue
- Allow both speed and depth
Start simple → scale when needed. No rewrites required.
| Developer | Needs |
|---|---|
| Product engineer | Ship fast |
| UI engineer | Customize deeply |
| Design system team | Enforce consistency |
Instead of:
- Copy-pasting dropdown logic
- Rebuilding variants per app
We centralize:
Behavior + flexibility in one place
When requirements evolve — nested menus, async loading, accessibility improvements, keyboard navigation — the foundation already supports them.
If you’re building a shared UI system, ask:
- Will this component be reused across multiple products?
- Do teams have different levels of complexity needs?
- Is developer velocity a priority?
- Will requirements evolve over time?
If most answers are yes, consider a hybrid approach.
Be pragmatic. Avoid hybrid patterns if:
- You’re building a small app
- There’s only one clear use case
- The team needs strict conventions
- Reuse is unlikely
- Separation of concerns
- Logic (state, context) lives in
useDropdown - Rendering (patterns) lives in
Dropdown,Dropdown.Trigger,Dropdown.Menu
- Logic (state, context) lives in
- Explicit APIs
- Props define behavior clearly
- TypeScript discriminated unions prevent accidental mixing of modes
- No implicit magic
- Single source of truth
- Shared internal state via
DropdownContext - Both API modes consume the same hook
- Shared internal state via
The best APIs reveal complexity only as it's needed — the fast path is the entry point, the compound path is the depth. Developers move between them at their own pace, without being forced to learn everything upfront. This is the same principle behind React itself: useState before useReducer, useEffect before custom hooks.
- Simplicity is contextual—not absolute
- Design systems require system thinking, not component thinking.
- Hybrid patterns can:
- Improve developer experience.
- Reduce duplication.
- Enable scalability.
- But they introduce:
- Maintenance overhead.
- Architectural responsibility.
A practical rule: if your component will be consumed in 3 or more distinct usage contexts — some needing speed, others needing control — a hybrid API is worth the overhead.
That engineer wasn’t wrong.
They were optimizing for clarity today. I was optimizing for velocity tomorrow.
And the truth is, both perspectives matter.
But at some point, the shift happens:
You stop designing components. You start designing systems.
What the hybrid actually buys is the right to change our minds about the internals.
Consumers code against behavior; everything behind it stays negotiable.