noora
Sign in

Installation

Add Noora to a Phoenix application: the dependency, the styles, the hooks, and the components.

  1. Add the dependency

    Noora is published to Hex. Add it to the dependencies in mix.exs:

    Elixir
    defp deps do
      [
        {:noora, "~> 0.81"}
      ]
    end
  2. Import the styles

    Import the fonts and the component styles in assets/css/app.css. noora/fonts.css loads Inter Variable and Geist Mono from Google Fonts and rsms.me.

    CSS
    @import "noora/fonts.css";
    @import "noora/noora.css";
  3. Register the hooks

    Interactive components such as dropdowns, modals, and date pickers run on LiveView hooks. Add them to the socket in assets/js/app.js:

    JavaScript
    import Noora from "noora";
    let liveSocket = new LiveSocket("/live", Socket, {
      hooks: { ...Noora.Hooks },
    });
  4. Use the components

    use Noora imports every component into a LiveView or component module.

    Elixir
    defmodule MyAppWeb.ProjectLive do
      use MyAppWeb, :live_view
      use Noora
      def render(assigns) do
        ~H"""
        <.button label="Create project" variant="primary" />
    """
      end
    end

Self-hosted fonts

To avoid requests to third-party font hosts, serve Inter Variable and Geist Mono yourself. Declare their font faces and import noora/noora.css without noora/fonts.css.

CSS
@font-face {
  font-family: "Inter Variable";
  src: url("/fonts/InterVariable.woff2") format("woff2");
  font-weight: 100 900;
  font-display: swap;
  font-optical-sizing: auto;
}
@font-face {
  font-family: "Geist Mono";
  src: url("/fonts/GeistMono.woff2") format("woff2");
  font-weight: 400 700;
  font-display: swap;
}
@import "noora/noora.css";