Moon is a multi-layered, scalable, customizable, and adaptable Design System.
Moon Liveview represents the third layer of the Moon Design System. The package relies on Moon UI CSS classes, which compose the second layer of Moon Design System.
Moon Liveview provides simple composable functional components.
Ensure you have the following prerequisites in place before proceeding with the installation:
Add a private
moon_live_view
package to
mix.exs
file:
defp deps do
[
{:moon_live_view, "~> 0.0.1"},
]
end
mix deps.get
Add a static plug to
endpoint.ex
file to serve static moon icons:
plug Plug.Static,
at: "/moon_live_view/",
from: :moon_live_view,
gzip: true
Add MoonLiveView to
html_helpers
function to make the package available globally:
defp html_helpers do
quote do
use MoonLiveView
end
end
Add
moonHooks
to
app.js
file to enable MoonLiveView components' functionality:
import moonHooks from "../../deps/moon_live_view/assets/js/hooks/";
let liveSocket = new LiveSocket("/live", Socket, {
hooks: {
...
...moonHooks,
},
});
Update HTML and BODY tags in
root.html.heex
file. Add
dir
attribute to the HTML tag to fully enable the LTR/RTL feature of Tailwind. Additionally, add a main theme class to the BODY tag to enable theme support in your app:
<html dir="ltr">
<body class="light-theme">