symfony / ux

Symfony UX initiative: a JavaScript ecosystem for Symfony
https://ux.symfony.com/
MIT License
856 stars 315 forks source link

[Feature Idea] Slider #2386

Closed Powh closed 1 day ago

Powh commented 4 days ago

Hello, do you think it would be interesting to create a Slider to scroll through images or cards horizontally using a Stimulus controller ?

smnandre commented 3 days ago

A UX Slider component? Genuine question, what would be the added value of having a PHP part / bundle here?

I feel like libraries like Swiper or Glide already do a great job, and I’m not sure we could make a real difference in terms of DX. I’m even a bit worried we might unintentionally limit their usage or API flexibility.

What do you think ?

Powh commented 3 days ago

Thank you for your quick response !

Indeed, I was initially thinking of creating a custom slider, but we can also integrate Swiper or Glide with Stimulus to avoid having to set up JavaScript configuration. Similar to the Symfony UX Typed package.

Kocal commented 3 days ago

Hi!

I'm not really convinced of the value of a Symfony UX package to create sliders.

Not because I don't like sliders for several reasons (performance, accessibility, visual fatigue, etc.), but mainly because I don't see any added value in doing it under the Symfony UX name.

Instead of installing their own JavaScript dependencies, users will have to download a PHP package to :

... Is it really worth it? I am not convinced of the added value of UX here.

And, yes, you mentioned the UX Typed package... well, I'm not a fan either, but it exists, and has the merit of having a Stimulus controller bundled with it.

But... in the case of a slider library, it's complicated. There are lots of easy-to-use libraries out there, such as Swiper or Glide mentioned earlier, all of which work differently, and we can't (or we don't want to, I think?) chose a library or another. Creating your own Stimulus controller and integrating a library into it is fairly easy, and much more customizable than if it were proposed by UX.

I'm not closing the discussion either, but let's imagine we wanted to create a UX package for sliders, how would users use it? In Twig? In PHP?

Thanks @Powh!

Powh commented 1 day ago

Okay, you convinced me haha,

Yeah, originally, I had imagined something where you set your parameters in Twig, and you get a slider that does the job. But indeed, it would be much more limited than a library, which isn't that complicated to integrate on your own.

Thanks to you!