Skip to content

UI components: using PhoenixKit's components in your own pages

Describes PhoenixKit 3.5.0.

PhoenixKit’s admin is built from a library of function components styled with daisyUI: buttons, inputs, tables, modals, badges, tabs and more. A host app can use the same components so its own pages match the admin. This guide is for developers; there is no admin page for it.

Where to find it

The components live in the phoenix_kit package under lib/phoenix_kit_web/components/core/, one module per component, each documented in its @moduledoc. Larger pieces sit one level up, such as PhoenixKitWeb.Components.MediaBrowser.

What’s included

Among the components the core set brings:

  • Forms: input, select, textarea, checkbox, simple_form, date_input, decimal_input, form sections and actions. Translatable fields for multilingual forms are in PhoenixKitWeb.Components.MultilangForm.
  • Tables and lists: table_default (with an optional card view for phones), tree tables, sortable headers, bulk selection, a column chooser, row menus, pagination and draggable_list for drag-and-drop ordering.
  • Feedback and layout: button, badge, modal, flash, empty_state (compact, card or featured), stat cards, charts, nav tabs, accordions, popovers and status dots.
  • Media: file upload, media thumbnails and the embeddable MediaBrowser with folders, upload, search and trash.

Using them in a host app

Host LiveViews get nothing from PhoenixKit automatically; importing is a deliberate step. Either import single modules:

import PhoenixKitWeb.Components.Core.TableDefault
import PhoenixKitWeb.Components.Core.EmptyState

or bring in the whole core set the way PhoenixKit’s own views do:

use PhoenixKitWeb, :core_components

A mix phx.new app already has its own button/1 and other helpers in CoreComponents. When both are in scope, the names clash. Exclude yours on import (import MyAppWeb.CoreComponents, except: [button: 1]) or delete the scaffold’s version.

The media browser has a helper that sets up uploads in one line:

use PhoenixKitWeb.Components.MediaBrowser.Embed

What it doesn’t do

  • There is no gallery page of the components inside the admin. Read each module’s documentation, or the admin’s own templates, for examples.
  • The components are styled with Tailwind and daisyUI classes, so the host app’s asset build must include them.