LiveUiKit (LiveUIKit v0.1.3)

Module Version Hex Docs Total Download License Last Updated

installation

Installation

If available in Hex, the package can be installed by adding live_ui_kit to your list of dependencies in mix.exs:

def deps do
  [
    {:live_ui_kit, "~> 0.1.0"}
  ]
end

Pick one of the available themes. :tailwind, :daisyui or :bootstrap

config :live_ui_kit,
  theme: :tailwind,
  otp_app: :my_app

Include the library in one of two ways. Either in a specific LiveView file:

defmodule ExampleAppWeb.PageLive do
  use ExampleAppWeb, :live_view
  use LiveUiKit

  # Other code
end

Or add this to the web module if you want to access it from all LiveView pages:

# app/example_app_web.ex
defmodule ExampleAppWeb do
  # Other code

  defp view_helpers do
    quote do
      use Phoenix.HTML
      import Phoenix.LiveView.Helpers
      import Phoenix.View
      import ExampleAppWeb.ErrorHelpers
      import ExampleAppWeb.Gettext
      alias ExampleAppWeb.Router.Helpers, as: Routes

      # ADD THIS
      use LiveUiKit
    end
  end
end

If you use Tailwind and use the purge option, add this line in the tailwind.config.js:

module.exports = {
  mode: 'jit',
  purge: [
    './js/**/*.js',
    '../lib/*_web/**/*.*ex',
    '../deps/live_ui_kit/**/*.yml' // Add this
  ],
  plugins: [
    require('@tailwindcss/typography'),
  ],
}