π Storybook
This project brings DaisyUI components into your Phoenix project.
mix archive.install hex daisy_ui_installer
In the Phoenix project folder
mix daisy
Alternative, you can just install a single component
mix daisy badge input
NOTE: This will install the components and it's dependencies.
Reference this repository on your mix.exs
file to start using.
def deps do
[
{:daisy_ui_components, "~> 0.9"}
]
end
Phoenix 1.8+ uses tailwind
and daisyui
configured out of the box. If your project is using an older version of Phoenix, you can install the daisyui
package manually.
Follow the official DaisyUI installation guide to install the package.
In order to use the translations that comes with phoenix, it's recommended to set the translate_function
in your config.exs
file.
config :daisy_ui_components, translate_function: &MyAppWeb.CoreComponents.translate_error/1
And to finalize, add under the app.css
file the following line to import this library tailwind styles:
@source "../../deps/daisy_ui_components";
To use the components in your project, you need to import the DaisyUIComponents
module in your web file, typically lib/my_app_web.ex
.
defp html_helpers do
quote do
# Translation
use Gettext, backend: MyAppWeb.Gettext
# HTML escaping functionality
import Phoenix.HTML
+ # Import DaisyUI components into your project
+ use DaisyUIComponents, core_components: false
import YourProjectWeb.CoreComponents
end
end
This will make all the components available in your templates with the exception of the phoenix core_components.ex
and layouts.ex
components.
If you want to use all DaisyUIComponents, set core_components: true
and remove the import for the phoenix CoreComponents.
defp html_helpers do
quote do
# Translation
use Gettext, backend: MyAppWeb.Gettext
# HTML escaping functionality
import Phoenix.HTML
+ # Import DaisyUI components into your project
+ use DaisyUIComponents, core_components: true
- import YourProjectWeb.CoreComponents
end
end
You may also find component conflicts on the layout.ex
file, you will need to comment the flash_group/1
component there too.
This library aims to integrate seamlessly with Phoenix generators. For this reason you don't need the components inside the CoreComponents
after adding use DaisyUIComponents
into your web file.
All the components should be compatible, styled with DaisyUI.
If you encounter any compatibility issues, feel free to open an issue
or submit a pull request
, and I'll take a look.
This project is fully compatible with the Liveview 1.0 π₯. If you are using a previous Liveview version, check the migration guide.
List of available components.
Component | Status | Storybook |
---|---|---|
Button | β | β |
Dropdown | β | β |
Modal | β | β |
Swap | β | β |
Theme Controller | β | β |
Component | Status | Storybook |
---|---|---|
Accordion | β | β |
Avatar | β | β |
Badge | β | β |
Card | β | β |
Carousel | β | β |
Chat bubble | β | β |
Collapse | β | β |
Countdown | β | β |
Diff | β | β |
Kbd | β | β |
Stat | β | β |
Table | β | β |
Timeline | β | β |
Component | Status | Storybook |
---|---|---|
Breadcrumbs | β | β |
Dock | β | β |
Link | β | β |
Menu | β | β |
Navbar | β | β |
Pagination | β | β |
Steps | β | β |
Tabs | β | β |
Component | Status | Storybook |
---|---|---|
Alert | β | β |
Loading | β | β |
Progress | β | β |
Radial progress | β | β |
Skeleton | β | β |
Toast | β | β |
Tooltip | β | β |
Component | Status | Storybook |
---|---|---|
Checkbox | β | β |
Fieldset | β | β |
File input | β | β |
Label | β | β |
Radio | β | β |
Range | β | β |
Rating | β | β |
Select | β | β |
Text Input | β | β |
Textarea | β | β |
Toggle | β | β |
Validator | β | β |
Component | Status | Storybook |
---|---|---|
Artboard | β | β |
Divider | β | β |
Drawer | β | β |
Footer | β | β |
Hero | β | β |
Indicator | β | β |
Join | β | β |
Mask | β | β |
Stack | β | β |
Component | Status | Storybook |
---|---|---|
Browser | β | β |
Code | β | β |
Phone | β | β |
Window | β | β |
Component | Status | Storybook |
---|---|---|
Flash | β | β |
Header | β | β |
List | β | β |
Simple Form | β | β |
Input | β | β |
Table | β | β |