UI Reference
Plutonium uses Phlex for all view components and TailwindCSS 4 + Stimulus for the frontend.
Sub-pages
- Pages:
IndexPage,ShowPage,NewPage,EditPage, render hooks, custom ERB views, context detection - Forms:
Formclass, field builder, association inputs (typeahead + inline add), themes - Displays:
Displayclass, custom rendering, block-form displays - Tables:
Tableclass, custom rendering, search/scopes bar - Components: built-in component kit, custom Phlex components,
DynaFrameContentpattern, modals & tabs - Layouts: shell config, ejecting chrome, custom
ResourceLayoutclass - Assets: Tailwind config, Stimulus controllers, design tokens,
.pu-*component classes, Phlexi themes
🚨 Critical (applies across all sub-pages)
- Override via nested classes in the definition.
class ShowPage < ShowPage; end,class Form < Form; end. Don't replace the entire view layer. - Use render hooks, not
view_template.render_before_content,render_after_content,render_before_toolbar, etc. exist so you don't reimplement the whole page. - All pages inherit
DynaFrameContent: turbo-frame requests render only the content. Don't fight it; modals and frame nav "just work". - Custom components inherit
Plutonium::UI::Component::Base: gives you the component kit (PageHeader,Panel,Block), resource helpers, and thehelpersproxy for Rails helpers. render_actionsis mandatory in customform_template: without it, the form has no submit button.- Custom CSS, brand colors, or your own Stimulus controllers need
pu:core:assetsfirst. Out of the box the app serves the gem's prebuiltplutonium.css/plutonium.min.js; the generator switches it to your own bundles. Don't hand-write the Tailwind/PostCSS pipeline. - Once the app owns its JS bundle,
registerControllers(application)must be inapp/javascript/controllers/index.js(pu:core:assetsadds it). Your bundle replaces the gem's, so without it Plutonium's Stimulus controllers (color-mode, form, slim-select, flatpickr, easymde, etc.) are dead. - Use
plutoniumTailwindConfig.mergewhen extending Tailwind theme, plain object merge drops Plutonium's defaults. - Style with
.pu-*classes first,var(--pu-*)tokens second, raw palette pairs last. Banners, badges, cards and buttons all have a.pu-*class that carries its own.darkrule. A hand-writtenbg-warning-50 dark:bg-warning-950/30pair duplicates that, drifts from the theme, and may not even exist in the prebuilt CSS. - User-facing copy goes through
t(...)with a locale key, in components, pages, displays and definitions alike. See i18n. - Configure inputs in the definition; render them with
render_resource_fieldin the form. Don't reimplement field widgets from scratch.
Related
- Resource › Definition: field-level rendering (
field :foo, as: :markdown,display :status do |f| … end) - Behavior › Controllers: controller render-context hooks (
present_parent?,submit_parent?)
