Headless UI Components for Phoenix

Unstyled, accessible UI components for Phoenix and Phoenix LiveView. To be styled with the CSS framework of your choice.

Screenshot

Goals & Rules

Components

NameStatus
Toggle (Switch)🏗️ In progress
Combobox (Select with search)🏗️ In progress

Installation

The package can be installed by adding headless to your list of dependencies in mix.exs:

def deps do
[
{:headless, "~> 0.1"}
]
end

Usage

You should not use Headless components directly but use them as building blocks for your own components.

See examples directory for styling examples.

defmodule MyAppWeb.Components do
use Phoenix.Component, global_prefixes: ~w(x-)
attr :field, Phoenix.HTML.FormField
def toggle(assigns) do
~H"""
<Headless.toggle field={@field} class="...">
<span class="...">Toggle</span>
</Headless.toggle>
"""
end
end

Development

# Start development server with examples
mix phx.server

Inspirations