DaisyUIComponents is a library that seamlessly integrates the amazing DaisyUI component library into your Phoenix LiveView project.
It replaces Phoenix’s default CoreComponents with pre-styled DaisyUI components, making it easier to switch your application’s UI.
It also provides 30+ DaisyUI components built in using the Phoenix component engine.
Thanks, Adilson, for checking it out! Any help is welcome and I would love to have contributors on the project. If there is a specific component you would like to see, let me know, I can prioritize it right away.
How much effort is it to upgrade to DaisyUI 5? Looks like you’ve already started but I’d be happy to help complete that if it wouldn’t get in your way.
thank you @typesend, I was planning to finish on 23th of this month, when I come back from traveling. If you need it sooner I can definitively take a look on your PR.
Overall the upgrade is simple, only exception is daisyUI forms with fieldset and labels, since the new classes they made for forms are not backwards compatible, kinda breaks the form components I built. If you want to give a try I can check it out
Since this library doesn’t handle the assets, it should work with the tailwind standalone or using directly the DaisyUI CDN.
The assets are handled by the application (that is including this lib) build process. On the readme I added the conventional way of adding daisyUI assets in a phoenix project, which is through npm but anything can work - e.g using bun for example.
This new version is now compatible with the new DaisyUI V5, thank you @typesend for starting this work on the repo.
The new UI can be seen on the storybook.
On top of that, new components were added, here is a quick display of them:
Label
The label component was introduced in the new DaisyUI version, we can add labels to inputs:
We can have labels before or after the input. We also have floating labels, take a look on the Label Storybook for all options
Fieldset
Probably the most important component of this release. The fieldset is useful to group several controls and is now used on all form inputs to group label, input and errors in a form.
Is there any plans to add more reactivity on top of the existing daisy components? It is a glaring hole atm in Daisy that almost nothing is mobile first (try looking at the tables from a phone), but this seems very achievable to patch over in the library. Adding things like attrs for the col slots for how it collapses in lower media queries etc.
There are plans to improve the components to have better ergonomics compared to the default daisyui styles. I’m implementing it little by little as I’m still focusing on having a bigger component coverage and storybook with all the examples.
As for having collapsible columns, this should already be possible if using the table without the col slots. Using table with col slots - instead of using thtd - is an option provided by this lib to have compatibility with the current phoenix generators. Since each element of the table can accept classes, you can choose to or hide/show a column based on a media query. For improving the table with slots, I can add a class attribute there so you can pass any class per column and I will also add on pipeline here to offer a collapsible option, great suggestion.
Splendid! And it is meant as critique of daisy itself, NOT of your package just to reiterate that.
I pay for tailwindui and everything there is staunchly mobile first, so it was a bit jarring to have to think reactively again when looking at Daisy again after the phoenix announcement to default to daisy