# Getting Started This guide walks through adding Phoenix Duskmoon UI to a Phoenix LiveView project. ## Prerequisites - Elixir ~> 1.15 - Phoenix ~> 1.8.1 - Phoenix LiveView ~> 1.1.0 - TailwindCSS >= 4.0 - [Bun](https://bun.sh) (for frontend package management) ## Installation ### 1. Add the Hex dependency ```elixir # mix.exs defp deps do [ {:phoenix_duskmoon, "~> 9.0"} ] end ``` ```bash mix deps.get ``` ### 2. Install frontend packages ```bash bun add @duskmoon-dev/core @duskmoon-dev/elements ``` `@duskmoon-dev/core` provides the CSS design system (theme variables, component classes, design tokens). `@duskmoon-dev/elements` is a meta-package that installs all `el-dm-*` custom element packages. ### 3. Import components in your view helpers In your `lib/my_app_web.ex`, add the component imports to `html_helpers/0`: ```elixir defp html_helpers do quote do # Import all Duskmoon UI components (dm_btn, dm_card, dm_input, etc.) use PhoenixDuskmoon.Component # Import CSS art components (dm_art_snow, dm_art_plasma_ball, etc.) use PhoenixDuskmoon.CssArt # ... your other imports end end ``` ### 4. Configure CSS In your `assets/css/app.css`: ```css @source "../js/**/*.js"; @source "../../lib/**/*.exs"; @source "../../lib/**/*.ex"; @import "tailwindcss"; @plugin "@duskmoon-dev/core/plugin"; ``` The `@plugin` directive registers the Duskmoon design system with Tailwind v4, providing all theme variables, component classes, and design tokens. ### 5. Register custom elements In your `assets/js/app.js`, import the element packages you use: ```javascript // Register individual elements import "@duskmoon-dev/el-button/register"; import "@duskmoon-dev/el-card/register"; import "@duskmoon-dev/el-input/register"; // ... add more as needed // Or register all elements at once import "@duskmoon-dev/elements/register"; ``` Each custom element must be explicitly registered for its tag to be defined in the browser. Without registration, content inside the element's `