Third-Party Components at Their Best
I’m a fan of the componentization of the web. I think it’s a very nice way to build a website at just about any scale (except, perhaps, the absolute most basic). There are no shortage of opinions about what makes a good component, but say we scope that to third-party for a moment. That is, components that you just use, rather than components that you build yourself as part of your site’s unique setup.
What makes a third-party component good? My favorite attribute of a third-party component is when it takes something hard and makes it easy. Particularly things that recognize and properly handle nuances, or things that you might not even know enough about to get right.
Perhaps you use some component that does pop-up contextual menus for you. It might perform browser edge detection, such as ensuring the menu never appears cut off or off-screen. That’s a tricky little bit of programming that you might not get right if you did it yourself — or even forget to do.
I think of the component that React Router has or what’s used on Gatsby sites. It automatically injects
aria-current="page"
for you on the links when you’re on that page. You can and probably should use that for a styling hook! And you probably would have forgotten to program that if you were handling your own links.
In that same vein, Reach UI Tabs have rigorous accessibility baked into them that you probably wouldn’t get right if you hand-rolled them. This React image component does all sorts of stuff that is relatively difficult to pull off with images, like the complex responsive images syntax, lazy loading, placeholders, etc. This is, in a sense, handing you best practices for “free.”
Here’s a table library that doesn’t even touch UI for you, and instead focuses on other needs you’re likely to have with tables, which is another fascinating approach.
Anyway! Here’s what y’all said when I was asking about this. What makes a third-party component awesome? What do the best of them do? (besides the obvious, like good docs and good accessibility)? Some of these might be at-odds. I’m just listing what people said they like.
- Plug-and-play. It should “just work” with minimal config.
- Lots of editable demos
- Highly configurable
- “White label” styling. Don’t bring too strong of design choices.
- Styled via regular CSS so you can BYO own styling tools
- Fast
- Small
- Is installable via a package manager
- Can be manually instantiated
- Can be given a DOM node where it can go
- Follows a useful versioning scheme
- Is manintained, particularly for security
- Has a public roadmap
- Is framework-agnostic
- Doesn’t have other dependencies
- Uses intuitive naming conventions
- Supports internationalization
- Has lots of tests
Anything you’d add to that list?
The post Third-Party Components at Their Best appeared first on CSS-Tricks.