Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

I am the opposite. Developing these components is like the most trivial task when starting a new project. Then again, I am not a React guy and usually frown at these prebuilt libraries as they tend to be opinionated and unpleasant to change for the use case at hand.

I don't know. Maybe I just don't like "ecosystems"



They're definitely not trivial. Do you build them well? I don't mean this as an insult to your work; I just know that these components have a million little details and edge cases that makes them not trivial if you care about getting them right.

Let's take a modal, for example. The easy part is clicking a button and having something show up on top of everything else. But do you…

- make sure screen readers announce it correctly when it's opened?

- make sure it has the correct ARIA attributes?

- trap focus within the modal so that you can't tab to an element in the page behind it?

- allow it to be closed with escape?

- return focus to the correct element when it closes?

These aren't arbitrary requirements I'm making up. The W3C has detailed documentation [1] about how people should be able to interact with these components. It's not something I want to spend my time doing, and frankly when it comes to things like ARIA attributes and screen readers it's not something I'm confident I'll do well. That's why libraries like Radix and React Aria are so valuable. You get rich, accessible components basically for free.

[1] https://www.w3.org/WAI/ARIA/apg/patterns/dialog-modal/


Boss: "So, when will the MVP of the screen be ready?" Dev: "Well, we need to hire a few more people and the build the date picker and select box, and then we can actually work on the stuff you asked. So about 2-3 months. Then we can start tackling the i18n and a11y bugs. EZPZ".

UI libs definitely have their drawbacks, but using headless component libraries like Radix or react-aria with your styling solution of choice gets rid of 90% of the problems they generally have.


You write your own component library when you start a new project?


It's better than dealing with vuetify and such. Writing this stuff is the easiest thing in a new project.

Am I out of touch? What do you do when you have tons of custom functionality and styles? I spent about an year in a huge react only shop and I swear these guys were spending most of their time debugging other people's crappy components. Most of them had your reaction when we talked


It’s a hundred times easier to build <shitty button the designers want with 6 states> from scratch than style an existing component from a component library. I would only use a component library for the things that are hard, like dialogs and multi select weird option lists etc.


Buttons, sure, you can mostly just style the built-in <button> tag. Libraries like this are useful for things that don't come included and are tricky to get right — custom selects, modals, dropdowns, toasts, etc.


What about accessibility? That's the biggest thing in my mind when I choose to use someone else's component library. Things like combo boxes, date pickers, popovers are non trivial in terms of placement and accessibility.




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: