Safeguard
Developer Tools•

Should a design system wrap its third party UI dependencies?

Wrapping a third party date picker or chart in your own component limits the blast radius of an update. When it pays off, what it costs, how to do it.

Safeguard Security Team
3 min read

Often yes, for dependencies that appear in many places or are likely to change. A thin wrapper component exposes your API and hides the third party one, so replacing or upgrading the package touches one file rather than every app. For small, stable helpers, wrapping adds cost without benefit.

What a wrapper does for updates

Imagine a date picker package used directly in forty places across ten apps. A security fix or a major release changes its props. Now forty call sites need edits, in ten repositories, owned by ten teams.

If your library exports its own date picker component that uses the package internally, apps see only your props. When the package changes, you adapt the wrapper once, publish a library release, and apps update a version number. The same applies if you ever need to swap the package for another because it is unmaintained.

When wrapping pays off

FactorWrapSkip wrapping
Used in many appsYes
Complex API likely to changeYes
Handles untrusted input, such as rich text or markdownYes, add sanitizing at the boundary
Single app uses itYes
Tiny pure function with a stable APIYes
Package is already a standard in your stackCase by caseCase by case

How to wrap well

  1. Define your own props, named for your product's needs, not copied from the package.
  2. Keep the dependency private to the library. Do not re export its types or components, or apps will import them anyway and the wrapper loses its value.
  3. Decide dependency or peer. If apps should share one copy, use a peer range as in how wide should a design system's peer dependency range be. If you want to control the version, make it a regular dependency, and remember what that means: consumers inherit it, and each patch needs a library release.
  4. Write tests against your API, so swapping the package is safe.
  5. Record the dependency in the library's inventory with an owner, so advisories reach someone.

Security angles

The wrapper is a good place for controls that should hold everywhere: escaping or sanitizing input, setting safe defaults, and refusing options you do not want apps to use. Remember that a wrapper reduces the number of places the package is used, not the fact that its code runs in your users' browsers. A vulnerable version still needs patching.

Vet new packages before adding them, as in how to vet a third party UI component before you add it.

Costs to be honest about

A wrapper is more code to maintain and document, and apps lose direct access to features you did not expose. Teams may ask for escape hatches. Offer a documented way to pass specific options through rather than leaving the full package API open.

Safeguard's reachability analysis can show whether a vulnerable function in a third party package is actually called by your wrapper, which helps rank updates by real exposure. You can run a free scan at gold.safeguard.sh/scan.

Quick check

Does a wrapper remove the need to patch the package?

No. The package still ships to browsers. The wrapper only limits how many places must change.

Should wrappers re export the package's types?

Avoid it. Re exporting invites apps to couple to the package and undoes the benefit.

Last reviewed: 19 October 2026.

Never miss an update

Weekly insights on software supply chain security, delivered to your inbox.

Self-healing security runs on Safeguard.

Your first fix PR is minutes away.

No sales call required, even your agent can complete the purchase over MCP.