cvkmohan
I am considering using Overview (shoelace.style) for the front-end part of the application.
Has anyone used web components as part of the LiveView? Will it slowdown the application significantly? Yes - handling forms might be unnecessarily complicated. Any other downsides? Is there any upside?
Trending in Questions
Hey guys,
I’ve got a huge CSV ( around 10 GB ) that needs to be processed hourly
Do you guys have any suggestions what is the best prac...
New
Hello!
Could someone please give me a help/sample code, how to delete a file from s3 using waffle/waffle_ecto from Phoenix app.
I creat...
New
I have what I’ve heard referred to as a “lookup table” in my database. This is a way of assigning codes to common values. One common lo...
New
What approach to take when sending live updates to “random” users Hi! I have a question, I have a little chat app, and when I create a DM...
New
Anyone here using Honeybadger?
My Honeybadger account is being overwhelmed with noise from some bots. Seeing a lot of
Bandit.HTTPError...
New
I’m seeing that a list inside a Kino.DataTable will be interpreted as a charlist, even if the Kino.configure() is set to charlists: :as_l...
New
Hi, I’ve just set up an application with ash_authentication. There is only magic link strategy for now, so there is no confirmation add o...
New
Other Trending Topics
I am happy to introduce the very α version of the new programming language compiled to BEAM.
Welcome Cure.
It has literally three kille...
New
Hobbes is a low-level distributed database for the Elixir programming language.
Hobbes provides a simple, safe, and scalable storage lay...
New
ExRatatui lets you cook up rich terminal UIs in Elixir, powered by Rust’s ratatui via Rustler NIFs. Build interactive terminal applicatio...
New
Hello everyone. After busy few months I am happy to announce v0.1.0 of Emerge & Solve.
They are GUI (Emerge) and State management (S...
New
Corex is an accessible, unstyled UI component library for Phoenix that integrates Zag.js state machines using Vanilla JavaScript and Live...
New
There are three potential reasons for members of this forum to have a look at https://vutuv.de
You are tired or annoyed of LinkedIn.
Yo...
New
Categories:
Sub Categories:
Forums
Popular Tags
- #ecto
- #liveview
- #troubleshooting
- #learning-elixir
- #deployment
- #library
- #erlang
- #testing
- #genserver
- #mix
- #absinthe
- #remote-other
- #otp
- #plug
- #how-to-question
- #macros
- #postgres
- #elixirconf
- #channels
- #exunit
- #discussion
- #code-sync
- #javascript
- #podcasts
- #onsite
- #dialyzer
- #docker
- #authentication
- #umbrella
- #full-time-contract
- #podcasts-by-brainlid
- #ecto-query
- #blog-post
- #elixir-ls
- #ai
- #elixirconf-us
- #phoenix_html
- #iex
- #graphql
- #genstage
- #websockets
- #supervisor
- #advent-of-code
- #distillery
- #processes
- #api
- #forms
- #hex
- #security
- #metaprogramming










Showing Posts 1 to 10- Show Best Posts
- Show All (oldest first)
- Show All (newest first)
trarbr
I have no experience using web components with LiveView, but there was a good talk about it at ElixirConf 2021: https://www.youtube.com/watch?v=xXWyOy9XdA8
ouven
I use custom components for small jobs in combination with live view. It worked very well so far.
When I want to give the full control of the tag content to the custom component, I put an phx-update=“ignore“ attributed at it. To pass data to the component via live view I use attributes and their change callbacks.
I would post example code here, but I am on vacation and my laptop had to stay at home.
adw632
I am investigating using shoelace with liveview currently.
The plan is to use Chris Nelsons live_elements with Shoelace web components.
Reason for this selection:
I am also aware that tailwind is not aligned with web components as it doesn’t support styling shadow DOM using parts of a web component (as there is no tag to hang a class on).
So your back to using CSS with @apply:
At this point I feel one may as well embrace the shoelace approach to CSS which in a way is better. Tailwind is the antithesis of broad app wide theming and I hate baking theme decisions in my code. I believe tailwind is at least one reason there isn’t a a compelling UI component library for Phoenix as they have little choice but to bake theme into the component markup and then it’s a pain to use them.
cvkmohan
Maybe with Tailwindcss 3.4, and the planned Oxide engine, things will change? I feel the reason for lack of a good UI component library is due to the absence of a library like Framer.
One thing is for sure - there are many takers for a good quality UI component library in LiveView. It is necessary for good Developer Experience. Let us see, from how and where we get it.
adw632
I think the first step IMO is a headless UI. The great thing about a headless UI is it provides a uniform contract and robust accessibility. Styling and theming are completely separate concerns.
Imagine if we could build liveview apps with headless component contracts. The ecosystem would have something to anchor to, tools, generators UI kits and CSS themes would emerge for Phoenix and Phoenix itself would be inherently CSS agnostic, anchoring to headless components.
Currently all we have are the core components stop gap for generators and they bake in tailwind styles. The current situation is kind of a mess.
I was also really keen on using shadcn-svelte with live-view but ran into some issues with live-svelte.
shadcn-svelte is basically a theming wrapper of bits-ui (a headless set of compnents) which is in turn composed using melt UI which is a headless component builder.
My reservation with webcomponents is SSR (server side rendering) as that is a requirement for many sites. For a SaaS app it’s less important as you’re not concerned with web crawlers and SEO.
I will see how the experiment goes with shoelace and report my experience with it back here.
krishandley
I’m currently experimenting with lit and it’s going very well so far.
I was about to give up on LiveView because that extra layer of UI polish was almost impossible with just hooks. But lit has opened it back up again.
I didn’t want to bring in a framework, things don’t always play nicely with esbuild. But I don’t need any fancy stuff just import lit!
And it’s possible to not use the shadow dom at all by doing createRenderRoot() { return this } so I can keep using tailwind easily.
adw632
Yes this is the last chance for liveview for me too. If I don’t get a good outcome I’ll be moving forward with SvelteKit and shadcn-svelte. If I go this route I will also look at live-state by Chris Nelson as an alternative to liveview and graphql.
Yes that’s correct if you’re wrapping your own components you can use the light DOM to expose the internals rather than the internals being private and selectively defining a contract for styling using the
part::selector.Shoelace can still use tailwind for styling if you choose to but specific overrides to internal component parts require use of @apply to target the parts.
I believe use of @appply is still required for light DOM web components as you still can’t put classes on those internal web component elements in your markup when using the component, but all the internals are exposed for styling with CSS via @apply. I much prefer the parts approach than having the fragile dirty internals of a web component reflected in my styling.
krishandley
I have a few form related components which have hidden inputs so I turn off the shadow dom for those.
I’m still using hooks as a first resort where possible, but if it’s too complicated for a hook. I’ve (so far) found a nice escape hatch with lit.
barkerja
Do you mind sharing a link to lit? This is the first I’ve heard of it.
outlog