Live data from Hacker News

The Overcomplexity of the Shadcn Radio Button

paulmakeswebsites.com

101–110 of 351 posts

Re: The Overcomplexity of the Shadcn Radio Button

#101
post #98

This is the kind of stuff we have to do because almost all browser 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.

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

Re: The Overcomplexity of the Shadcn Radio Button

#102
post #98

This is the kind of stuff we have to do because almost all browser 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.

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!

Re: The Overcomplexity of the Shadcn Radio Button

#103
post #101
post #98

This is the kind of stuff we have to do because almost all browser 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.

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

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.

Re: The Overcomplexity of the Shadcn Radio Button

#104
post #13
post #8

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

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.

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.

Re: The Overcomplexity of the Shadcn Radio Button

#105
post #60

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 d…

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…

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.

Re: The Overcomplexity of the Shadcn Radio Button

#106
post #89
post #28

Earlier quoted context omitted.

> - 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? l…

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.

> 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.

Re: The Overcomplexity of the Shadcn Radio Button

#107
post #30

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

> 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…

>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.

Re: The Overcomplexity of the Shadcn Radio Button

#108
post #10

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…

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.

Re: The Overcomplexity of the Shadcn Radio Button

#110
post #98

This is the kind of stuff we have to do because almost all browser 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.

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!

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.
Post reply on HN