Creating an awesome component library for Phoenix

Hey y’all!

The “promise” of Phoenix + LiveView, as least the way I perceive it, is that it’s especially suitable for solo developers and small teams, that don’t want to build a React app that loads 3 MB of JS to display “hello world” :slight_smile: . I think we’re close, but I don’t think we’re there just yet!

One key thing thing I think is missing is a good component library - and this doesn’t get enough attention IMO.

I’m mostly a backend developer, and I really don’t want to spend more time than necessary to get my site to look decent. React developer are super-spoiled and can find dozens of high quality UI component libraries.

What I personally would need from a component library would be:

  1. It looks “good” (I know, this is subjective). Think “Material UI” or “Tailwind UI” to get an idea of what I’m after.
  2. To use Atomic Design language - it should contain “molecules”, “organisms” and “template” components and not just “atoms” (basically more “complex” components than just a simple button).
  3. It follows some well established design system (e.g. Material Design). Attempting to come up with a good design system by oneself is a huge task!
  4. Purely functional components to keep things simple.
  5. It should be reasonably “complete” and contain the majority of components needed to build a website.

My questions

  1. Is there something like this out there already, and my Google-fu is just failing me?!
  2. If not - does anyone have any thoughts on how to best collaborate on making something like this? Is there a component library project that shows promise, but isn’t quite there, that I could contribute to?
  3. Are there any other people out there who are interested in trying to make this happen? Or is it perhaps just a me-problem, and y’all have already found good solutions for it?

I don’t wanna be the person that creates the 15th half-baked component library for Phoenix, that no one will be using :slight_smile: .

image

4 Likes

If You want to stick to liveview components, there is SaladUI… getting some traction

Its goal is to replicate shadcn UI with live components

I don’t think SaladUI is production ready yet, e.g. the dropdown doesn’t work as one would expect yet.

There is petal. I’ve not looked at it for a while but it looks like they’ve kept working on it.

There is moon which looked a bit flaky to me when it came out but have no idea of the quality now.

1 Like

Thanks a bunch @kokolegorille and @cmo - I didn’t know about Moon or SaladUI.

I’m gonna leave this thread to marinate here for a bit, to see if someone else has any libraries or thoughts to contribute.

I’m slowly building a headless library of UX components that could be then used with any html/css - headless - Headless (unstyled) UI components for Phoenix (with Alpine)

Thanks for posting this thread. It seems very important to me. I have personally grappled with it and am not at all sure that I’ve chosen a good path.

An accepted and high quality component library might give Phoenix and LiveView a significant boost of adoption.

I wonder what the Phoenix/LiveView development team’s position on this is?

Is CoreComponents the first step in the creation of a defacto standard?

1 Like

I feel Doggo should be mentioned here too.

2 Likes

SaladUI is advancing quite fast.
Dropdown is behaving nicely SaladUI - Dropdown Menu

I’ve started using it with satisfaction.

Have you tried using a keyboard to operate it?

are you referring to arrows or the keyboard shortcuts like ⌘T ?

For the arrow control, I would expect it to be used in the Select component ( SaladUI - Select ) and yes it’s a bit buggy. The approach in the code seems a bit cumbersome ?
Personally I’m using Choices and then just skinned it so it match the look and feel.

For the shortcuts like ⌘T, i would expect it to be handled by your application event handlers.

Components library rarely ( never ) cover all needs. It’s just a starting point.

Based on my understand of the docs CoreComponets aren’t (currently at least) meant to become a defacto standard component library. The docs state that “This module is a great example of defining function components to be reused throughout our application.” (emphasis mine).

After letting this marinate for a long time and making a few exploratory attempts myself I realized I underestimated the work needed to make a great component library.

I won’t attempt it myself, since I feel I don’t have the UI skills required to pull it off, nor do I have the time. However, if someone needs some help with developing one of the libraries they’re already contributing to, please hit me up! I’d be all for throwing in a couple of hours here and there to help out wherever it makes sense.

Something I really want to do is to build that complete Component Library with Phoenix LiveView as first citizen. I did postponed my intention since we might be getting some Web Components integration with LiveView, so rather wait for that before committing and having to re-write a large portion of the code base.

2 Likes