Six Zero-Dependency UI Components That Grew Out of a Color Picker
Teams building form-heavy admin interfaces can reuse these six battle-tested-style components directly, cutting out the usual framework lock-in and dependency bloat. The package structure also serves as a practical model for extracting shared UI primitives from a domain-specific widget.
The author of the open-source color picker `@ew-color-picker` found that the picker needed a text input, number input, button, dropdown, checkbox, and tooltip — and realized these are the same building blocks that almost any admin interface or form needs. Rather than reimplement them in every project, each was extracted into its own npm package with a tiny dependency graph: only `utils` for most, and `tooltip` additionally for the dropdown's truncation hint.
These components are not tied to any framework. They return native DOM nodes via `getElement()`, expose typed options and callbacks, include a `destroy()` method for clean disposal, and share a consistent CSS-variable-based theme. They can be consumed as ES modules or loaded from a CDN as UMD bundles. The tooltip is the most feature-packed, aiming for parity with Element Plus's `el-tooltip` — supporting 12 placements, fallback placement flipping, delays, multiple triggers, teleporting, virtual triggering, and a full event lifecycle.
An interactive playground with numbered examples lets you try each component live, and the project is available on GitHub and npm under the `@ew-color-picker` scope.
Extracting generic UI primitives from a single-purpose widget is a sound architectural move, but it only pays off when the primitives are genuinely identical across contexts; here the shared truncation logic shows that even small cross-cutting concerns benefit from a single implementation.
The tooltip's explicit goal of matching el-tooltip feature-for-feature raises expectations — it's not just a simple bubble but a full-featured popup system, which suggests the author values drop-in compatibility over minimalism.
The zero-dependency, native-DOM approach trades convenience for portability: you get no framework integration out of the box, but you can wrap it in Vue/React with custom bindings (the project already ships wrappers), making the core stable across ecosystems.
This splitting approach really hits the spot—one small component forcibly split into six general-purpose components that can each fly solo. The bit where select missed the tooltip.css import and didn't error out made me laugh; silent degradation is the worst trap.
If importing styles separately is a hassle for you, then I'll provide an all.css.