The Overcomplexity of the Shadcn Radio Button

(paulmakeswebsites.com)

272 points | by dbushell 3 hours ago ago

122 comments

  • ehnto 2 hours ago

    I don't touch frontend very often anymore, but you could see the writing on the wall for complexity when React took over and newer devs were working exclusively in that abstraction.

    Unlike other abstractions where things get tidied up and more simple, React is much more complex than the technology it's building on. Necessarily, to enable it's features, but none the less it is a consequence of this that when all someone knows is React or other frameworks, things get overengineered. They didn't realise it could be so much simpler if they just knocked it back a layer instead of climbing higher and higher.

    • WA an hour ago

      > when all someone knows is React or other frameworks, things get overengineered

      The next level annoyance is that everybody just assumes React to be the default for everything.

      Check the Shadcn website. The landing page doesn’t mention that this is a React-only UI library at all. Same with Radix. The marketing sounds like a general-purpose UI lib. You gotta dig around a bit to realize that this is React-only.

      • trueno 14 minutes ago

        my brain for whatever reason won't accept react it's just instant ejection. i was there in the before times all the way up till jquery became uncool and i just tuned out of front end entirely once react and all the stuff driven by facebook became so ubiquitous, my soul just does not want to dabble in any of it. i think im mostly just appalled at what feels like over complexity that might've made sense over a decade ago but perhaps im waiting for a more satisfying paradigm to come along. i dunno. i had some sparks of joy tinkering with golang to build ssr stuff, i dont keep up with wasm at all but i hope its cruising along.

        i wonder if what im after is like some kinda dead simple easy to use declarative front end api that can be built from a backend, something like streamlit or nicegui that has great ergonomics and is easy to maintain but scales better and has better state mgmt than streamlit & puts all the power of a general purpose programming language right there with it. i love compiled things i hate setting up environments with runtimes and stuff.

      • TheCapeGreek 14 minutes ago

        I've started straight up being doubtful of every UI kit until I see in the docs a HTML or non-React example.

    • smartmic an hour ago

      You make a good point. From a philosophical point of view, abstractions should hide complexity and make things easier for the human user. It should be like a pyramid: the bottom layer should be the most complex, and each subsequent layer should be simpler. The problem is that many of today's abstractions are built on past technology, which was often much better designed and simpler due to the constraints of that time. Due to the divergent complexity of today's abstractions and unavoidable leaks, we have a plethora of "modern" frameworks and tools that are difficult to use and create mental strain for developers. In short, I always avoid using such frameworks and prefer the old, boring basics wherever possible.

    • wouldbecouldbe 2 hours ago

      It was fine when it started, it's the addition of useEffect and hooks that messed everything up. Although normaly I prefer functional, for react classes were 100 times better

      • yoz-y 42 minutes ago

        I know people love to make UIs stateless and functional. But they just aren’t. IMO UIs are fundamentally a bunch of state, graphically represented. So naturally all of the functional frameworks are full of escape hatches.

        I’d rather have a honest framework than a chimera.

        I have not followed SwiftUI recently but when it was introduced I quite liked to have the main composition in SwiftUI and then writing more complex components in pure UIKit. Both could be used what they are best suited for. But trying to shoehorn good interactivity into a SwiftUI component always ended in horrible code.

      • realusername an hour ago

        I also have the same somewhat controversial opinion, the frontend community wasn't ready and (still isn't) to organise a functional codebase.

        The second problem is that React has a "draw the rest of the owl" mindset. Sure you have nice frontend components but now what about caching? data transfers? static rendering? bundle size & spliting? routing?

        • jcgl 41 minutes ago

          Yeah, as a solo dev quite new to frontend, that made me nope out of React almost immediately. Having to choose a bunch of critically important third-party dependencies right out of the gate? With how much of a mess frontend deps seem to be in general? No thanks.

          I settled on Svelte with SvelteKit. Other than stumbling block that was the Svelte 4 -> 5 transition, it's been smooth sailing. Like I said, I'm new here in the frontend world and don't have much to judge by. But it's been such a relief to have most things simply included out of the box.

          • Tade0 15 minutes ago

            I've been doing frontend since 2012 and I still don't understand why React became so popular.

            No two React projects are the same. Like, even the router has at least three different mainstream options to choose from. It's exhausting.

            • jcgl 6 minutes ago

              That router thing seems crazy. I'm all for having options that are available. But not having, at the minimum, some blessed implementations for basic stuff like routers seems nuts. There is so much ecosystem power in having high-quality, blessed implementations of things. I'm coming from working primarily in Go, where you can use the stdlib for >80% of everything you do (ymmv), so I feel this difference very keenly.

    • socalgal2 27 minutes ago

      Is this the same with everything? In the past, a hard drive, a mouse, or a web camera was a dumb piece of hardware and a driver that ran on your PC. Now, IIUC, each of those has it's own computer (SoC) running an entire OS. Your phone probably has ~20+ SoC. One for USB, one for Wifi, One for Bluetooth, one for each of the 4 cameras, one for lidar, one for SSD, one for cellular, one for the secure enclave, one for audio, Each of them is an entire computer, more powerful than most 1980s general purpose computers, running an entire OS with multiple abstractions internally and all of that to make that device appear as yet another abstraction.

      Am I wrong?

    • curtisblaine 2 hours ago

      Managing state and syncing it to the DOM manually is much harder than React (or any other big framework) for any non-trivial web app. Reactive, inherently asynchronous, event driven applications get complex easily.

    • hahahahhaah 2 hours ago

      The problem is app-document impedence mismatch. CSS makes stuff easier but for doc-like pages. In addition doc-like pages want some app-like niceness too.

      If you need to be an app you usually need a framework to stay sane (evidence: most other native UI kits are frameworks of some sort) and thus React etc. But they want full contol. Thus 2 ways to do a radio etc.

    • teaearlgraycold 2 hours ago

      Worse still is the misunderstanding that React is simple. It’s an endless stream of cache invalidation bugs. Linters are getting better at catching these. But they also have false positives.

      • tiborsaas 33 minutes ago

        What is cache in this context? useState? What do you mean by cache invalidation in react apps?

  • cadamsdotcom 13 minutes ago

    A html forms based radio button is worse than a complex - but standard - shadcn radio button many ways that matter in the real world.

    Why does no one do the simpler thing? Because there’s no extra value to it, and it in fact has negative value because then the team has to write and understand it and the rationale for the departure from just using the same component library everywhere.

    “Only a few kb of javascript” may as well ZERO javascript, and because of that it’s not even close to the top thing to optimize on your favorite site.

    So, you engineered a non-standard radio button that is different to the rest which all use shading?? Why weren’t you building features that you know.. make money?

    • snowmobile 5 minutes ago

      How's using a custom library any way close to "standard"? How about the actual HTML standards? The whole reason you'd use "shadcn" is that customizing the actual HTML radio button isn't enough for you. Otherwise, if you just want a default-looking button, here you go:

          <input type="radio" name="beverage" value="coffee" />
      
      If your team can't understand that, how are they going to understand a few KB of JS? Or maybe they're not supposed to understand it, but how can you then guarantee to your customers there isn't a crypto miner or tracker or something in that? Or perhaps you care more about "making money" than protecting your customers from such things?
  • benrutter 2 hours ago

    This radio selection is brilliant silly, especially because the end result is indecipherable from a vanilla css rqdio button.

    For some reason people keep going back to complex UI and interactivity frameworks though, does anyone have a good example of a large website built without all this bloat?

    Asking because I've seen hundreds of small sites built with elegance and simplicity, and few large ones. Is it just inevitable that as a team size grows, someone introduces insanity? Do these tools solve an actual problem that I'm missing?

    • hu3 2 hours ago

      https://www.mcmaster.com

      2022 post about it. 1400 points. ~500 comments:

      https://news.ycombinator.com/item?id=32976978

    • yellow_lead 2 hours ago

      > does anyone have a good example of a large website built without all this bloat?

      How about this one?

      • teaearlgraycold 2 hours ago

        Don’t think it counts

        • rrr_oh_man 2 hours ago

          Why not?

          • 946789987649 2 hours ago

            I'm assuming they're asking for large in terms of complexity, not in terms of popularity.

          • Levitz an hour ago

            Because this site is only "large" in the context of userbase. It could be developed by a single guy in what, a week? Two tops?

            • Bishonen88 42 minutes ago

              With LLM? More like within Day(s).

    • rustystump 2 hours ago

      Cant speak for shady lib specifically but yes as you grow you do find that default styling doesnt work or you want something which doesn’t exist.

      The crux tho is that this usually happens in what id call web apps and not websitess. Web apps are far more complex and powerful. It is a spectrum tho and sometimes websites grow into web apps which is why people oft over engineer early on.

  • yen223 an hour ago

    This is the kind of stuff we have to do because almost all browser <input> elements are terrible in terms of customisability. Especially radios and selects

    If you're one of those who think we should just use the default, bear in mind that the default radio button has poor usability for mobile users.

    • barryvan an hour ago

      There are lots of ways to style these native controls, though, including ways to start from scratch and retain the accessibility affordances.

      I'd be curious to know more about the usability issues you've found on mobile -- I've not had any personally when using radio buttons. I'll readily grant you that 'select' is awful everywhere though!

      • DrewADesign 42 minutes ago

        It’s a lot easier now than it used to be. Radio buttons used to be nearly impossible to style, and I still think they require scripting to de-select— so none in a group are selected after one has been selected. I’ll bet most of the complexity in the article is some combination of keeping support for older browsers, technical debt, and nobody complaining about it because it works.

    • ruszki an hour ago

      The article explains how to style radio buttons with CSS however you want. What’s the problem with that?

      • supermatt an hour ago

        It doesn’t.

        It gives a very naive approach that doesn’t support any complex styling.

        For that you need to wrap the input and additional styling elements in a ref’ed label.

        • mcintyre1994 27 minutes ago

          Out of interest what's an example of styling that the radix/shadcn version enables that their approach doesn't? I was able to (AFAICT) replicate the radix docs example by just moving their styles around: https://codepen.io/mcintyre94/pen/pvbPVrP

        • whstl 13 minutes ago

          Wrapping it in a label is the idiomatic and correct way, and should be done even when not styling. Perhaps especially when not styling.

          Putting an adjacent label is also possible, but scales poorly due to needing unique ids.

        • ruszki 29 minutes ago

          Can you give an example please? What kind of complexity are we talking about?

        • ifh-hn 29 minutes ago

          But is that still less complex than what the author found?

    • archerx 25 minutes ago

      The only <input> that is annoying to style is the “select” one because it’s hard to style the “options”. The rest seem reasonable and quite customizable in my experience.

    • spiderfarmer an hour ago

      > bear in mind that the default radio button has poor usability for mobile users

      Wrap it in a label, give the label a padding. Boom!

  • neya 3 hours ago

    I have absolutely no doubt that somehow all these projects and similar ones - started with good intentions - good looking UI, implement and forget. And then, one fine day you're sitting on top of 200+ lines of code for a radio button and 7 imports and it's too hard to go back now without tearing the whole codebase apart. This is how code rot starts.

  • jackfranklyn 2 hours ago

    The real cost of this complexity isn't the code itself - it's onboarding. Every new dev joining the project has to understand why a radio button needs 47 lines of JSX with Radix primitives, context providers, and styled variants.

    I've watched teams spend weeks just getting comfortable with component library internals before they can be productive. Meanwhile the "simpler" vanilla approach might have taken an afternoon to build but takes 20 minutes to explain.

    That said, if you're building something like Figma or Linear where you genuinely need the accessibility primitives and keyboard navigation that Radix provides, the complexity pays for itself. Most CRUD apps don't need it though.

    • normie3000 an hour ago

      > I've watched teams spend weeks just getting comfortable with component library internals

      Would a good library allow developers to ignore internals and get on with higher-level stuff?

    • snowmobile 2 hours ago

      > It isn't A -dash- it's B

      Suspicious choice of words.

  • parhamn 3 hours ago

    I normally share the sentiments of the article. But I am also curious, if the goal was:

    - Implement the radio as the designer sent in the figma file (e.g. something like the radix demo one they're commenting on: https://www.radix-ui.com/primitives/docs/components/radio-gr...)

    - Make sure it looks the exact same across all browsers

    How doable is it with vanilla css? The example they gave was rendered to a black/white circle, most teams wouldn't ship that.

    • going_north 2 hours ago

      You can get a lot closer with only small modifications:

          input[type="radio"] {
            appearance: none;
            margin: 0;
            width: 25px;
            height: 25px;
            background: white;
            border-radius: 50%;
            display: inline-grid;
            place-content: center;
            box-shadow: 0 2px 10px color(display-p3 0 0 0/0.5);
      
            &::before {
              content: "";
              width: 11px;
              height: 11px;
              border-radius: 50%;
            }
      
            &:checked::before {
              background: color(display-p3 0.383 0.317 0.702);
            }
          }
      
      Here's a link to a codepen so you can see what it looks like without rendering it yourself: https://codepen.io/erikaja/pen/RNRVMyB
    • mcintyre1994 an hour ago

      Fun exercise! https://codepen.io/mcintyre94/pen/pvbPVrP

      Everything in styles.css in that example maps to the vanilla input, so you just have to move them around a bit. Should work at least as well as theirs across browsers, because it's vanilla inputs and the same CSS.

    • DecoySalamander an hour ago

      > How doable is it with vanilla css?

      Under all of the framework complexity that specific look is still achieved with CSS. In fact, you could rip out the CSS they use with very little modification and pair it with a ~five-line React component that doesn't require any third-party imports.

    • atoav 3 hours ago

      Where do you draw the line tho? How many kilobytes and how much future maintenance work is avoiding a potential slight visual inconsistency with a radio button worth? Is it worth to lose the x amount of people who have bad network connection?

      Use this approach everywhere and the actual content of the page (you know: the stuff people came for) suffers.

      All I can think about is a quote by world famous video artist Nam June Paik: When to perfect, Gott böse ("God gets mad when too perfect", the original isn't exactly a full sentence and mixes English and German).

      • rustystump 2 hours ago

        Based on profits of many webapps, there is no line. What eng here forget is that they are oft not the targeted consumer. The hypothetically perfect website doesnt sell as well as a colorful fat choncker does. It is like fast food, not every cares about farm to table.

        • Dylan16807 2 hours ago

          Except the correct way can be just as colorful, and it takes more effort to implement the bad way.

          • girvo an hour ago

            The bad ways effort was already paid by someone else, though.

        • stephenr 2 hours ago

          > It is like fast food, not every cares about farm to table

          I mean, a "colorful fat choncker" website is literally the opposite of fast food - its slower to arrive, and focuses way too much on appearances.

          In this analogy, the website using these ridiculous abstractions is more like Salt Bae or whatever idiotic trend has replaced him. All glitz, zero substance, slower, and for no apparent reason.

          The fast food equivalent is stuff like the Google home page: it doesn't validate, is actively harmful to you, the community, and the planet but is immensely popular.

    • antisol 2 hours ago

        > - Make sure it looks the exact same across all browsers
        > How doable is it with vanilla css? 
      
      It's not doable with your fancy frontend framework and your 20 imports and your ten thousand lines of typescript.

      "Make sure it looks the exact same across all browsers" is, and always has been, fundamentally at odds with how the web is intended to work.

      How well does this shadcn crap render in arachne? ladybird? netsurf? links? dillo? netscape 3? The latest version of chrome with user styles applied?

      When you say "exactly the same", I assume you mean that the design only uses black and white, because some people might have black and white monitors, right? But you're also going to use amber-on-black because some people might have amber screen monitors, right? How do you plan on ensuring it looks exactly the same on a braille terminal?

      Maybe you think I'm being silly. Because nobody uses monochrome monitors in 2026, right? So it's safe to ignore that and put an asterisk next to "exactly the same" (And also just forget that e-ink is a thing that exists).

      (Just like how it was safe in 2006 to assume people would always have 800x600 or bigger displays, and nobody would ever come along using a screen with, say, 480×320 resolution)

      What measures have you taken to ensure that your colours appear exactly the same across a bunch of different types/brands of monitors that render colours differently? Or, perhaps we should just add another asterisk next to "exactly the same"?

      I could go on.

      How many asterisks is acceptable before "exactly the same" isn't a thing anymore?

      If "exactly the same on all browsers" is one of your goals, you are wrong. If your designer tells you that's what they want, they are wrong. If you ever tell a client that's what you're providing, you are wrong.

      • bandrami 2 hours ago

        Particularly given that on a screen reader -- which yes is an example of a browser -- it doesn't "look like" anything at all

      • Kinrany an hour ago

        Displaying the same thing on every monitor to the degree that monitor allows is well-defined. The browser may not be able to show some colors and the browser may decide to display things differently on purpose, but it's perfectly reasonable to want to unambiguously express what you _want_ the browser to display.

        • Maxion an hour ago

          > Displaying the same thing on every monitor to the degree that monitor allows is well-defined.

          In this case the website will not appear the same on every browser. Most browsers have a zoom function that the user controls which is an accessability feature. This changes how the website renders on the page.

      • curtisblaine 2 hours ago

        Exactly the same when rendered by the evergreen mainstream browsers. That's perfectly doable.

  • Surac 2 hours ago

    Im not in web development. Reading this article makes me think: is it realy neccersary to use all those complex frameworks? Isn't html/css enough? People always say "every line not written can't be a bug" but moving those lines into a library was not the idea behind the words

    • techpression 14 minutes ago

      A lot of frontend developers today (my experience) does't even know where to look for CSS updates or what vast amount of HTML element exists, they just know to look for frameworks and that's how they see the world. Like <input> is foreign to them, they only know of <FrameworkTextComponent>.

      Sometimes you do need a framework, but the question is being asked way too seldom.

    • curtisblaine 2 hours ago

      > Isn't html/css enough?

      No, obviously. If you are writing complex web applications with state, local processing of data and asynchronous interactions it's not enough. You need javascript. If your javascript is especially complex and you desire it to be declarative, you probably need a framework. Do you need, I don't know, Tomcat in Java? Probably yes for a complex application and no for a simple proof of concept. Do you need a database? Aren't files enough? And so on.

      Shadcn is a framework for developers who develop highly interactive web apps. If all you need is a static form that submits data to a web service, you probably don't need a framework (except when you need it - for example, selects are not yet fully styleable in all browsers).

      Next objection usually is: do you need complex apps on the client? Can't they be reduced to a series of simple forms controlled by the server? Sometimes they can and sometimes they can't, but of course I will decide the shape, behaviour, complexity and look of the applications I build (or have others build for me), thank you very much.

      That said, radio buttons have been styleable in all non-legacy browsers for at least 5-6 years, there's no excuse for rewriting them from scratch with svgs.

      • freetonik an hour ago

        >If you are writing complex web applications with state, local processing of data and asynchronous interactions it's not enough.

        >Next objection usually is: do you need complex apps on the client?

        It's not even an objection, it's a question I ask and almost never hear a coherent answer to. The vast majority of web applications I use every day (online banking, github, forums, social media, admin interfaces of various developer tools, etc.) don't really need to be dynamic and frontend-rich. I don't care if submitting a form refreshes the page. Funnily enough, full page refresh with a full round trip with "old school websites" is often faster than dynamic SPA interaction.

        I don't care that when I click "delete", the item may not disappear from the screen immediately. I don't want to see some in-between state descriptions like "Deleting..." because I know it's a lie in a distributed, eventually consistent system. Just tell me the truth: the request has been sent. I can then refresh the page and see the new current state, whatever it is.

        I really don't understand this desire to make websites behave like local apps while in reality they aren't.

      • dreadnip an hour ago

        Most web apps are a combination of static pages, simple forms and highly interactive content though. That's what makes the choice so hard.

  • mcintyre1994 43 minutes ago

    I think this is the equivalent of the radix demo (which has better styling than the shadcn one) in plain html/css: https://codepen.io/mcintyre94/pen/pvbPVrP

    Copied styles from the radix docs: https://www.radix-ui.com/primitives/docs/components/radio-gr...

  • mastermedo 3 hours ago

    The shadcn radio button in action: https://ui.shadcn.com/docs/components/radio-group

    • rpastuszak an hour ago

      Protip: the space between the UI control and the label should be done using padding (or achieved via label nesting) so that the entire area is clickable.

          [ x ]   some long label
               ꜛꜛꜛ
               padding here, not margins or gaps
      
      (clicking between the control and the label does nothing now)
      • hanspeter 23 minutes ago

        Calling this a "Protip" is generous.

        That the combined element has any surface area that doesn't toggle the radio setting is a straight-up bug.

        It is laughable for a component this heavily refined to have such a basic usability flaw.

    • tobyhinloopen 2 hours ago

      Is this developed by these 10x developers I've heard about?

    • maelito 3 hours ago

      This interactivity definitely adds a wow effect.

      • supriyo-biswas 3 hours ago

        Is it sarcastic or does it appear only on high frame rate devices? To me it simply feels like another radio button.

        • hu3 3 hours ago

          > Is it sarcastic or does it appear only on high frame rate devices? To me it simply feels like another radio button.

          You're absolutely right!

          Today I'm using a friends gaming computer. It's a 244hz monitor powered by a RTX 5070 TI and a screamingly fast AMD Ryzen 7 9800X3D CPU with 128GB of overclocked 6000MT/s RAM.

          Not only does the radio look mundane for such overcomplicated component, but it also misses clicks where I would expect it to register. Like slightly above or below it.

          For example, clicking where the pointer is in this image does NOT select the first radio button. It's not forgiving with regards to precision.

          https://i.imgur.com/PNoCJeL.png

          • skrebbel 2 hours ago

            It also doesn't catch clicks between the label and the radio button.

        • skibz 2 hours ago

          I'm pretty sure it was a sarcastic comment.

          On a recent MBP, it's indistinguishable from a vanilla radio button.

      • promiseofbeans 2 hours ago

        In a hilarious turn of fate, on iOS safari the first time one of the radio options is clicked after loading, the css focus style is applied, but a click is not always registered so the radio item ends up stuck in an invalid weird-looking state. I highly doubt the issue would occur if the built in radio were being used

  • jwr an hour ago

    Incidentally, radio buttons are a (sadly) forgotten art and are neglected in modern browsers. There are many issues with them, which is why people reimplement them on their own.

    • uxcolumbo 31 minutes ago

      Can you provide more details about the issues?

  • gustavorg 21 minutes ago

    As I was reading this text, my hands started sweating, my head began to ache, and I felt the anguish and terror of reliving a traumatic experience all over again. I can’t even count how many times I’ve been stuck in a project that’s already behind schedule, where the client (I’m a freelancer, working directly with the person who has the requirement) throws in a ‘simple’ request like: change the style of that radio button so it matches this other one. The problem isn’t that—because of reasons like the ones explained in the article—I end up spending hours and hours on what looks like a trivial task. The real nightmare is when the client asks me: ‘Why are you taking so long to do something so dumb?’ It’s a nightmare. That’s why I ran away from React, because of this and countless similar situations, and went back to WordPress, where the world is so much simpler, the clients are happy, and so am I.

  • xearl 3 hours ago

    Did they ask the original authors of Radix why it's the way it is?

    • leoff 3 hours ago

      Exactly this. OP fails to understand that there are reasons why it was done this way, and that someone who spent thousand of hours working on this might know something that they don't.

      • whackernews an hour ago

        Well, usually, the reasons are to support every single use-case. A great selling point, but ultimately why I don’t like using things like this and importing loads of other libraries. Most of the code your importing is for some other user and any one app will probably be using a slither of the functionality.

        I know if the lib is written well then you won’t be introducing unused code into your code base but you still often are left with an overly complex scaffold or other infrastructure to support all the stuff you’re not using. Just use a radio button for gods sake.

      • Alupis 2 hours ago

        Perhaps this is the original PR for the Radio/RadioGroup[1].

        It does seem the complexity was a deliberate decision.

        [1] https://github.com/radix-ui/primitives/pull/121

        • chrismorgan 2 hours ago

          Half of that complexity springs from the requirement of being able to put any element as the radio button. If you’re willing to say “you can only use anything that can be expressed with CSS applied to the <input type=radio>, including psuedoelements” (which is plenty for thing like shadcn), it melts away.

          The other half of it looks to come from an overloaded Label component which should probably have been split into two. There’s a reason that HTML has <fieldset> and <label> as different things. The implementation is also trivially incorrect: role=label isn’t a thing. Other parts of it are wrong or dubious too. In general, if the HTML way of expressing something isn’t permitted, the ARIA way of expressing the same thing is probably wrong too.

          And so it goes, through the entire system. They assume you might want something ridiculously complex, and so they complicate and make worse the normal case.

      • snowmobile 2 hours ago

        "There are reasons" is a pretty bland defense of why something was done in a bad way. You'd have to show that the reasons are valid, which I highly doubt. Also, somebody spending thousands of hours on making a worse version of something existing, isn't a good justification either. That's on the level of counting lines of code as a measure of productivity.

      • pftburger 2 hours ago

        Can here to say this exactly. Not saying they don’t raise an interesting point but the complete lack of curiosity why a group of experts in simplicity and accessibility decided to take this path is jarring

        • stephenr 2 hours ago

          > a group of experts in simplicity and accessibility

          According to who? This alone is a pretty damning case against such a claim.

      • ErroneousBosh an hour ago

        Okay, what exactly are those reasons?

        Why does it need so much complexity to draw a radio button that doesn't look all that different to the normal one you'd get with a perfectly ordinary <input> field, except it takes around ten seconds to draw and then doesn't work properly?

      • stephenr 2 hours ago

        I mean, that much is obvious just based on casual reading of a few articles/discussions about "modern" front-end dev.

        I am 100% convinced that "Modern" front end developers are in fact, afraid of CSS and HTML. Like, "it will steal my eyeballs and look back at my face with them" scared.

        Nothing else explains things like this, tailwind, JSX components, etc. Nothing. There is no explanation besides absolute morbid fear of the underlying technology - because the browser support has improved immensely but apparently they're all deathly scared of using it.

        Before you tell me that I don't know what challenges these problems solve: I was primarily doing front-end development.... 20ish years ago. One of my first jobs in the space was adapting the client side code for a J2EE app - mostly this meant removing an IKEA worth of tables and using CSS - in IE6 of all fucking things. Subsequently I created reusable UI frontend components (i.e. output some HTML, maybe this little bit of corresponding JS, you'll get a usable interactive components in a browser) for two different organisations.

        I have said it before and I'll say it again. I think JavaScript developers heard about (or saw over someone's shoulder) how J2EE guys had ant/etc build toolchains, and had abstraction like FactoryFactoryImplementationFactoryBuilderFactory and said HEY THAT LOOKS COOL, and if it's harder to understand they can't fire me!!

        It's like NIH syndrome but for an entire community of people whose primary goal is chasing the shiny, followed closely by resume padding.

    • curtisblaine 2 hours ago

      In 2020, radio buttons weren't easily stylable in all mainstream evergreen browsers. That's usually the case why some components are over engineered. Of course they should have simplified them when all browsers fell in line, but tech debt is hard.

  • worldsayshi 3 hours ago

    Well Shadcn gives you more freedom to fix stuff like this and rewrite how you want the component to work and look, since everything lives in your own code base. In a regular component lib it would be less likely that you'd think about this complexity, since it would be "hidden" away in node_modules or even transpiled and minified.

    • scoot 3 hours ago

      > everything lives in your own code base

      A common misconception.

      In reality Shadcn is a thin wrapper around libraries such as Radix, recharts, etc. The article says as much.

      • chrysoprace 36 minutes ago

        Sure, but if you wanted to change it to just use a radio input you could. Shadcn gives you a baseline.

      • worldsayshi 2 hours ago

        Sure, that's true. I oversimplified.

  • kaizenb 26 minutes ago

    I use shadcn/ui for side projects, mostly coding with agents.

    Good to have a base design system for building products.

    Are there any alternatives? Coded systems, not just UI components.

  • dagss 2 hours ago

    I am pretty new to frontend development (but have 20 years of backend)

    I assumed I would need to use one of these libraries at some point. But, perhaps since I am using Svelte instead of React, whenever I ask AI to do something, then since I don't already use a component lib it just spits out the HTML/CSS/TS to do the job from scratch (or, depending on how you look at it, output the mean component from its training data).

    I have to point out it should organize the code and give the component a dedicated Svelte file (sure I could fix AGENTS md to do that).

    I think with AI the usecase for these libraries is much lower. If there is anything complex you need AI can build it in some seconds specifically tailored for you, so..

    • ErroneousBosh an hour ago

      I've been dabbling in backend and frontend stuff for about 25 years now, but for the past 15 years or so I haven't really had to do any webby stuff for work (and that's kind of how I like it).

      Recently I've needed to put together a few things as "proof of concept" for things like internal directories and catalogues, and it's one of those "How Hard Can It Possibly Be" situations where we've had folk prevaricating for months with outline drawings and sketches and mockups.

      So I knocked together a backend for it in Django, which worked okay, and then styled up the raw template with MinCSS[1], and then to do stuff like "find-as-you-type" and other "magical dynamic page" things I used HTMX[2] which has been discussed here endlessly.

      No need for AI sloppiness. Just write some code, look at some examples, stick in some styles, and away you go.

      [1] https://mincss.com/examples.html

      [2] https://htmx.org/

      • dagss an hour ago

        I've used HTMX-like approaches a lot for other apps and I've been pretty frontend-averse, but this time I'm doing something similar to a drawing program with lots of d3 and SVG etc, very much the "real usecase" for SPA. So I feel HTMX doesn't apply to this specific usecase.

  • caseyross an hour ago

    This is only "overcomplex" from a naive point of view.

    Radio buttons, as with all UI controls, have tremendous inherent complexity, which comes to light once requirements ask for something beyond the blessed happy path of the default browser button. Pixel perfect styling, animations, focus behaviors, interactions with external state, componentized branding to fit in with companies' ecosystems, etc.

    The baseline <input> paradigm struggles to provide the tools needed to adequately handle this complexity, even today, after many decades of web development.

    And of course --- you can also argue that we should all just use the default browser button and everything should be solved. But this is also suboptimal, as it's clear from research that users prefer custom buttons if they provide more "features" than the defaults.

    • snowmobile an hour ago

      > it's clear from research that users prefer custom buttons if they provide more "features" than the defaults.

      Hate to be asking for a "source", but what research? And what "features" can a radio button even have? You click it and it's selected. I suppose accessibility can be considered "features", but I'm strongly suspecting that the overcomplex button has worse accessibility.

      > all UI controls, have tremendous inherent complexity

      Well, this is true in a sense, but it's not exactly a good argument for re-implementing all that complexity in JS / HTML, instead of simply using the browser's implementation that's written in a real language.

    • invalidusernam3 an hour ago

      Agree, this kind of complexity is there for a reason. I would rather have a complex component that handles all the cases within its usage in the codebase over having a bunch of little hacks/changes in the usage. It's far easier to maintain one complex component than many different usages of that component.

      And you don't have to use such a complex component library if you don't need it. For small codebases it often is overkill. But for large codebases it's a massively worthwhile investment.

  • ediatedia an hour ago

    Ok, I'll bite. I've been coding for almost 25 years so have seen various things come and go, so hopefully have a bit of capital in the bank.

    Don't get me wrong, a HTML5 radio button is a beautiful thing, and sometimes React is a hammer and everything is a nail.

    However, I think something that OP doesn't mention super explicitly in their post is the codebase they are working on is probably a React codebase. React is a great abstraction for building UIs. I've built a ton of them and the complexity only needs to go above a certain degree until you need a way more descriptive way of explaining your UI based upon other state, instead of trying to wire a load of DOM elements together.

    If you are already using the React ecosystem, for things like form validation (again, possible with HTML5 but as soon as the complexity cranks or you can't use the server - you probably need a library), then using something like Radix is a great choice, OP even mentions how although it's not technically a visible radio button that is shipped to the DOM, it acts like one for a11y reasons, and this is due in part because it's very, very easy to write inaccessible HTML. And ShadCN is pre-made components on top of that, and they all work pretty well together.

    Nothing is perfect, but even in my "old man yells at cloud" era, I personally don't think this one is worth yelling at the cloud for.

  • interstice an hour ago

    The dropdown systems are something else, I spent almost as much time on that as I did on the rest of the interface when I tried Shadcn.

  • feverzsj an hour ago

    That's why I never touch web frontend dev.

  • shubhamjain 3 hours ago

    This is the reason I absolutely hate shadcn. The number of dependencies and files you introduce for trivial components is insane. Even tiny little divs are their own component for no good reason. I genuinely don’t understand how front-end developers accept this level of needless complexity.

    Shoutout to Basecoat UI[1], so implementing the same components using Tailwind and minimal JS. That's what I am preferring to use these days.

    [1]: https://basecoatui.com/

    • discomrobertul8 2 hours ago

      > I genuinely don’t understand how front-end developers accept this level of needless complexity.

      in my anecdotal experience as a bit of an old fogey with a greying beard, the enthusiastic juniors come along, watch a video by some YouTube guru (who makes videos about code for a living instead of making actual software) proselytizing about whatever the trendy new library is, and they assume that it's just what everyone uses and don't question it. It's not uncommon for them to be unaware that the vanilla elements even exist at times, such is the pervasiveness of React bloat.

      • rustystump 2 hours ago

        Please name some names of these performative developer/engineers. I want to know how many are on my bingo card. Ill start, something imegen and tnumber geegee.

    • nake89 an hour ago

      Another shoutout to Basecoat. Easy to use. Makes your website look nice. Works with any/no framework.

    • esskay 2 hours ago

      I'd never heard of basecoat but it looks great. IMO this is what Tailwind UI should have been. It was utter stupidity that they forced you to use their preferred shiny new JS framework of the week for UI components.

      > I genuinely don’t understand how front-end developers accept this level of needless complexity.

      I call it 'Shiny Object Syndrome' - Frontend devs tend to love the latest new JS frameworks for some reason. The idea of something being long running, tried and tested and stable for 5-10 years is totally foreign to many FE devs.

      Despite its age JS and its ecosystem have just never matured into a stable set of reliable, repeatable frameworks and libraries.

    • jiangplus an hour ago

      This looks awesome.

  • pembrook 2 hours ago

    It has to be this way because we (the collective we) refuse to agree on adding proper UI primitives to the web.

    We’re like 20+ years into web apps being a big thing and there’s still nothing like what’s offered in OS-native frameworks like Swift.

    So anybody building a web app has to recreate SwiftUI in the browser every time via various bloated hacks (basically what Shadcn is).

    If we could just agree on adding non-terrible cross-browser primitives for multiselect, popovers, modals, proper radio buttons, tabs, etc to the HTML spec and allow extensive CSS styling on every part of the element we could avoid these massive UI frameworks.

    • mad182 2 hours ago

      Radio buttons are in html spec for over 30 years and they allow extensive CSS styling on every part of the element.

  • maelito 3 hours ago

    Note on the fact that this would add JS that needs to be loaded to see the page. No, because similar smart people created server-side rendering, adding another layer of complexity.

  • joduplessis 2 hours ago

    Yup. Unfortunately common I think - not just with UI components. Occam's razor is sometimes only for others.

  • supermatt 2 hours ago

    > Why would you want to do this?

    Have you tried completely customising a radio button with CSS? Feel free to demonstrate a heavily customised radio button style where you don’t hide the native appearance.

    • snowmobile 2 hours ago

      There's literally an example of that in the post.

      > where you don’t hide the native appearance

      What do you mean by this? Seems like an arbitrary requirement to set. Could you show an actual example of how this overengineered style is easier to customize?

      • supermatt an hour ago

        The pseudo element solution alone is extremely limiting in its ability to be customised. For more complex customisation you will need to decorate with additional elements within a ref’ed label - and then you are effectively back to what radix does.

  • eddie1o 3 hours ago

    There has to be a reason for picking button instead of input type="radio", right?

    • curtisblaine 2 hours ago

      Yep, radio buttons weren't easily stylable in all evergreen browsers back on 2020.

  • jojobas 38 minutes ago

    And then you realize this paradigm plagues even desktop applications through electron and the like. Enshittification knows no borders or limits.

  • PunchTornado 3 hours ago

    and people complain about AI code?

    • helloplanets 2 hours ago

      Shadcn most likely contains a lot of LLM generated code. Isn't it owned by Vercel these days?