Installation
Add the package, then import the components, the styles and the hooks.
1. Dependency
# mix.exs defp deps do [ {:ledger_ui, "~> 0.1"} ] end
2. Components
# lib/my_app_web.ex defp html_helpers do quote do use LedgerUI end end
3. Styles and icons
/* assets/css/app.css */ @import "tailwindcss"; @import "../../deps/ledger_ui/assets/css/ledger_ui.css";
The icons are Hugeicons Stroke Rounded, rendered on the server and used by name: <.icon name="huge-home-01" />.
4. JavaScript
// assets/js/app.js (NODE_PATH inclui deps)
import {Hooks, DOM} from "ledger_ui"
const liveSocket = new LiveSocket("/live", Socket, {
hooks: {...Hooks},
dom: {onBeforeElUpdated(from, to) { DOM.onBeforeElUpdated(from, to) }},
params: {_csrf_token: csrfToken}
})With no bundler, serve priv/static with Plug.Static and import /ledger_ui/ledger_ui.esm.js in a <script type="module">.
5. Toaster
<.toaster flash={@flash} position="center-bottom" />