Cinder

Tables, lists and grids of Ash resources in Phoenix LiveView, with filtering, sorting, search and pagination.

<Cinder.collection resource={MyApp.User} actor={@current_user}>
  <:col :let={user} field="name" filter sort>{user.name}</:col>
  <:col :let={user} field="email" filter>{user.email}</:col>
  <:col :let={user} field="department.name" filter sort>{user.department.name}</:col>
  <:col :let={user} field="settings__country" filter>{user.settings.country}</:col>
</Cinder.collection>

Cinder reads your Ash resource to pick each filter's type (enums become selects, dates become date pickers, and so on), and loads what each column shows, including relationships, calculations and aggregates.

Features

Installation

With Igniter:

mix igniter.install cinder

This adds the dependency, sets up Tailwind and the daisy_ui theme, and registers Cinder's LiveView hook. To install by hand, see Getting Started.

Quick Start

<Cinder.collection resource={MyApp.User} actor={@current_user}>
  <:col :let={user} field="name" filter sort>{user.name}</:col>
  <:col :let={user} field="email" filter>{user.email}</:col>
  <:col :let={user} field="role" filter>{user.role}</:col>
</Cinder.collection>

For a list or grid, describe each item with an <:item> slot. The <:col> slots then only configure filtering and sorting:

<Cinder.collection resource={MyApp.Product} actor={@current_user} layout={:grid} grid_columns={3}>
  <:col field="name" filter sort />
  <:item :let={product}>
    <div class="p-4 border rounded">{product.name}</div>
  </:item>
</Cinder.collection>

Documentation

Requirements

Contributing

dev/ holds a Phoenix app for trying out Cinder's features by hand: each layout, every filter type, pagination, selection and bulk actions, and the custom slots, with a switcher for the built-in themes. It uses Cinder from this repo, so changes to lib/ reload in the browser without a restart.

cd dev
mix setup
iex -S mix phx.server

Then visit localhost:4000. mix check, run from the repo root, also runs the dev app's tests.

License

MIT License - see LICENSE file for details.