frontpage.
newsnewestaskshowjobs

Made with ♥ by @iamnishanth

Open Source @Github

fp.

Open in hackernews

The Overcomplexity of the Shadcn Radio Button

https://paulmakeswebsites.com/writing/shadcn-radio-button/
148•dbushell•1h ago

Comments

neya•1h 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.
PunchTornado•1h ago
and people complain about AI code?
helloplanets•46m ago
Shadcn most likely contains a lot of LLM generated code. Isn't it owned by Vercel these days?
worldsayshi•1h 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•52m 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.

worldsayshi•21m ago
Sure, that's true. I oversimplified.
eddie1o•1h ago
There has to be a reason for picking button instead of input type="radio", right?
mastermedo•1h ago
The shadcn radio button in action: https://ui.shadcn.com/docs/components/radio-group
maelito•1h ago
This interactivity definitely adds a wow effect.
supriyo-biswas•1h ago
Is it sarcastic or does it appear only on high frame rate devices? To me it simply feels like another radio button.
hu3•49m 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

skibz•33m ago
I'm pretty sure it was a sarcastic comment.

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

promiseofbeans•18m 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
xearl•1h ago
Did they ask the original authors of Radix why it's the way it is?
leoff•58m 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.
pftburger•46m 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•29m ago
> a group of experts in simplicity and accessibility

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

Alupis•42m 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•4m 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”, 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.

stephenr•30m 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.

antisol•20m ago
well said!
parhamn•1h 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.

atoav•50m 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•33m 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.
stephenr•23m 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.

Dylan16807•21m ago
Except the correct way can be just as colorful, and it takes more effort to implement the bad way.
going_north•37m 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
antisol•34m 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•19m ago
Particularly given that on a screen reader -- which yes is an example of a browser -- it doesn't "look like" anything at all
maelito•1h 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.
dchest•44m ago
How do you implement this keyboard navigation with SSR (if you use buttons)?

https://www.radix-ui.com/primitives/docs/components/radio-gr...

DougBTX•37m ago
I can’t tell if this is sarcasm or not! Radio buttons support keyboard navigation without JS.
dchest•33m ago
That's what I mean: if you reimplement it, you need client-side JS to support keyboard navigation.
shubhamjain•47m 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•37m 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•29m 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.
esskay•34m 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.

benrutter•42m 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?

rustystump•36m 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.

yellow_lead•17m ago
> does anyone have a good example of a large website built without all this bloat?

How about this one?

teaearlgraycold•6m ago
Don’t think it counts
hu3•3m ago
https://www.mcmaster.com

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

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

Surac•33m 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
curtisblaine•4m 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.

demarq•30m ago
So many things wrong with this blog post. Any seasoned frontend dev would have EASILY pointed these out for you.

OP, I think your being a bit hasty here, more curiosity will do you good.

Dylan16807•25m ago
If all you have to contribute is being insulting, you don't have to comment.
anonymous908213•25m ago
Go on, then. Point them out.

As it is, you've joined the ranks of multiple others commenters who sound like cargo cultists, attacking OP for not understanding frontend dev without actually pointing out any issues in their writing. If it's easy to point out, then surely you can show how easy it is.

joduplessis•26m ago
Yup. Unfortunately common I think - not just with UI components. Occam's razor is sometimes only for others.
pembrook•23m 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.

jackfranklyn•23m 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.

ehnto•13m 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.

teaearlgraycold•7m 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.
hahahahhaah•3m 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.

dagss•1m ago
I am pretty new to frontend development.

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/JS to do the job frol 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..

Show HN: Local and Private TradingView Alternative

https://www.vaultcharts.com/
1•AlexBThomsen•6m ago•0 comments

Antarctic penguins have shifted their breeding season

https://www.theguardian.com/world/2026/jan/20/antarctic-penguins-shift-breeding-season-climate-ch...
2•mykowebhn•7m ago•0 comments

Winaskpass: WSL SSH-add helper using WinCred

https://scarpino.dev/posts/winaskpass-wsl-ssh-add-helper-using-wincred.html
1•ilpianista•10m ago•0 comments

Extracting verified C++ from the Rocq theorem prover at Bloomberg

https://bloomberg.github.io/crane/
1•clarus•11m ago•1 comments

Show HN: Explic – An AI tutor that prompts you with questions, not answers

https://www.explic.app/
1•IndieDev-Will•12m ago•1 comments

Ask HN: Is it still worth building an AI tools directory in 2026?

1•NewWebDev•12m ago•0 comments

SSH to Get Your Coffee

https://www.terminal.shop/
1•michael-sumner•18m ago•0 comments

PardusAI – no prompt, only 1 CSV file, full self data analysis

https://pardusai.org/
1•lidangzzz•22m ago•0 comments

UK gambling regulator accuses Meta of lying about struggle to spot illegal ads

https://www.theregister.com/2026/01/20/uk_gambling_comission_criticizes_meta/
1•xyzzy3000•24m ago•0 comments

The Door

https://xorvoid.com/the_door.html
1•ibobev•27m ago•0 comments

Markdown Is the Best Format for Note-Taking

https://oneuptime.com/blog/post/2026-01-19-why-markdown-is-the-best-format-for-notetaking/view
1•ndhandala•29m ago•0 comments

Two Cheers for Ugly Code

https://www.johndcook.com/blog/2026/01/19/ugly-code/
1•ibobev•30m ago•0 comments

I used AI chatbots as a source of news and they were unreliable and erroneous

https://theconversation.com/i-used-ai-chatbots-as-a-source-of-news-for-a-month-and-they-were-unre...
1•JeanKage•31m ago•0 comments

The Copyrightability of Fonts Revisited

https://matthewbutterick.com/chron/the-copyrightability-of-fonts-revisited.html
1•7777777phil•31m ago•0 comments

Show HN: UggPugg-find the connections between anyone and anything

https://uggpugg.com/
1•soderpop•32m ago•0 comments

We have conducted a comprehensive safety test of electric buses

https://ruter.no/en/ruter-with-extensive-security-testing-of-electric-buses
1•tigerlily•33m ago•0 comments

Show HN: KindleBox, an infinite canvas for notes, links, media, and RSS

https://kindlebox.app
1•ianclemence•36m ago•0 comments

Model-Market Fit

https://www.nicolasbustamante.com/p/model-market-fit
1•bfelbo•37m ago•0 comments

What's so bad about Microsoft?

https://www.kmfms.com/whatsbad.html
1•lr0•37m ago•0 comments

Show HN: Vibe Coding Entire Full-Stack Apps with AI

https://www.subterranean.io/
1•wordongu•41m ago•0 comments

6 Years Building Video Players. 9B Requests. Starting Over

https://www.mux.com/blog/6-years-building-video-players-9-billion-requests-starting-over
1•bolp•45m ago•0 comments

Lessons from creating a gaming-oriented scheduler

https://lwn.net/Articles/1051430/
1•todsacerdoti•47m ago•0 comments

Enterprise Bulk File Renamer with Preview, Undo, Force-Rename, and CSV Export

https://gum.new/gum/cmjzyahd9001n04l4fmdwbz24
1•Dev_Master•47m ago•1 comments

QMD - Quick Markdown Search

https://github.com/tobi/qmd
2•saikatsg•51m ago•0 comments

Frankenwine: Multiple Personas in a Wine Process

https://nullprogram.com/blog/2026/01/19/
1•ingve•52m ago•0 comments

A nice implementation of AI summary – Spicy Takes

https://benn.spicytakes.org/
1•articsputnik•55m ago•0 comments

Show HN: Pygments Swift – Swift-native syntax highlighting library

https://github.com/muonium-ai/pygments-swift
1•senthilnayagam•57m ago•0 comments

Ask HN: What is the most difficult tech/dev challenge you ever solved?

1•chistev•57m ago•1 comments

Diving into the Depths of Widevine L3

https://neodyme.io/en/blog/widevine_l3/
2•azalemeth•58m ago•0 comments

Zeiss, the company behind ASML optics, is also doing wildlife monitoring with AI [video]

https://www.youtube.com/watch?v=7kKJOphMxUw
3•bonplan23•58m ago•0 comments