defmodule PrimerLive do @moduledoc ~S'''
PrimerLive components can be used in Phoenix LiveView pages and regular (non-LiveView) views in Phoenix applications.
The Primer Design System provides a strong base for creating data driven applications such as rich CRUD applications with interactive forms.
Since this implementation closely adheres to the Primer CSS documentation, extending components with Primer's utility classes should be simple.
## Demo [PrimerLive Storybook](https://primer-live.org) ## Source code [PrimerLive at GitHub](https://github.com/ArthurClemens/primer_live) ## Installation ### Install primer_live Add PrimerLive as a dependency in your Phoenix application's `mix.exs` ``` {:primer_live, "~> 0.2.1"} ``` Run `mix.deps get` ### Add CSS and JavaScript dependenciesYou can either use `npm`, or add the dependencies to the HTML file.
If you plan to use menus, dialogs, or drawers in your project, you will need to include JavaScript dependencies. If not, you may skip the JavaScript imports and hooks.
To ensure that the assets are installed before your application has started, and before it has been deployed, add "npm install" to the setup and deploy scripts in mix.exs.
For example:
``` defp aliases do [ setup: ["deps.get", "cmd npm --prefix assets install"], "assets.deploy": [ "cmd npm --prefix assets install", "esbuild default --minify", "phx.digest" ] ] end ```Run mix setup to install the npm dependencies.
Add to assets/js/app.js:
Also in assets/js/app.js, add Prompt and Session to the hooks:
Load the dependencies from a content delivery service such as unpkg.
Add to root.html.heex:
Add to root.html.heex:
In assets/js/app.js, add global Prompt
and Session
to the hooks: