Bienvenido a PureAdmin para Phoenix
keen_pure_admin is a Phoenix LiveView component library that wraps the
Pure Admin CSS framework (@keenmate/pure-admin-core) into function components
and LiveComponents.
Drop-in replacement for Phoenix CoreComponents — provides button/1,
modal/1, table/1, input/1, and 35+ more components
with full BEM class support.
Components
Ready to use
JS Hooks
LiveView integrated
Themes
Fully customizable
Acerca de esta demo
This documentation site showcases the keen_pure_admin component library with multiple theme options. Use the settings panel (gear icon) to switch between themes and customize the appearance.
Cambio de tema y FOUC
On initial page load, you may notice a brief flash of the default theme before your selected theme loads. This is expected behavior in this demo.
Why? The default theme is bundled statically to prevent unstyled content (FOUC), then your saved theme preference loads dynamically via JavaScript.
Uso en producción
In a production application, you would import only one theme statically in your CSS. This eliminates the flash entirely since there's no theme switching overhead.
Acerca de SettingsPanel
The SettingsPanel component (gear icon in the corner) is primarily a demo and development tool
to showcase what's possible with pure-admin-core. It's not typically something you'd expose to end users in production.
Arquitectura de producción
In a real application, these settings would be handled differently:
- App-level constants (hardcoded): theme, layout width, sidebar behavior — decided during development
- User preferences (stored per-user): font size, compact mode — saved to user profile/database
- Design decisions (not configurable): avatar visibility, icon-only tabs — part of your app's design
The SettingsPanel demonstrates runtime customization, but most apps would make these choices at build time or store them server-side.
Instalación
Prerequisites: create a Phoenix project without Tailwind:
mix phx.new my_app --no-tailwind
Add keen_pure_admin to your mix.exs:
Desde Hex (recomendado)
{:keen_pure_admin, "~> 1.0"}
Desde GitHub
{:keen_pure_admin, github: "KeenMate/keen-pure-admin", tag: "v1.0.0"}
Configuración básica
After installation, replace Phoenix's CoreComponents with PureAdmin and set up the layout.
-
Reemplazar la importación de CoreComponents
In your
MyAppWebmodule, replaceimport MyAppWeb.CoreComponentswith:use PureAdmin.Components
-
Instalar un tema
Download a theme from pureadmin.io or use the Pure Admin CLI:
npx @keenmate/pureadmin install audi
-
Configura el diseño
<.navbar> <:burger><.navbar_burger /></:burger> <:start> <.app_header>My App</.app_header> </:start> </.navbar> <.layout> <.layout_inner> <.sidebar> <.sidebar_item label="Dashboard" icon="fa-solid fa-gauge" href="/" /> </.sidebar> <.layout_content> <.main> <%= @inner_content %> </.main> </.layout_content> </.layout_inner> </.layout> -
Registrar hooks de JS
In your
app.js:import { PureAdminHooks } from "keen_pure_admin" let liveSocket = new LiveSocket("/live", Socket, { hooks: { ...PureAdminHooks } }) -
Usa componentes en cualquier lugar
<.card title_text="My Card"> <.alert variant="info">Welcome to Pure Admin!</.alert> <.button variant="primary">Submit</.button> </.card>
Tamaño de fuente adaptable
Pure Admin uses a 10px rem base — the html font-size is 10px, so all rem values
scale proportionally. Changing the html font-size scales the entire UI: text, spacing, components.
Forma abreviada (recomendada)
One class for the common case — default on desktop, larger on mobile:
<html class="pa-font-responsive"> <!-- Desktop: 10px base (16px body text) --> <!-- Mobile (<=768px): 12px base (~19px body text) -->
Control granular
Pick exact sizes for desktop and mobile independently:
<html class="pa-font-base-10 pa-font-mobile-12">
| Clase | tamaño de fuente de html | Resultado del texto del cuerpo |
|---|---|---|
pa-font-base-9 / pa-font-mobile-9 |
9px | ~14px |
pa-font-base-10 / pa-font-mobile-10 |
10px | 16px (default) |
pa-font-base-11 / pa-font-mobile-11 |
11px | ~18px |
pa-font-base-12 / pa-font-mobile-12 |
12px | ~19px |
@media (max-width: 640px) {
html { font-size: 12px; }
}
Temas disponibles
Pure Admin comes with 5 example themes that serve as starter packs for your own customization. Each theme demonstrates different color schemes and provides a foundation you can build upon.
Audi
Clean design with sharp contrasts. A good starting point for modern admin interfaces.
Corporate
Traditional look with conservative colors. Starter for business-oriented applications.
Dark
Dark mode example. Use as a base for building your own dark theme variant.
Express
Bolder accent colors. Example of a more vibrant color palette.
Minimal
Subtle colors with reduced visual noise. Starting point for minimalist designs.
Resumen del componente
The library includes 35+ components organized into logical categories:
Diseño
- Layout, LayoutInner, LayoutContent
- Navbar, NavItem, NavDropdown
- Sidebar, SidebarItem
- Main, Footer
Formularios
- Input, Select, Textarea
- Checkbox, Radio
- SimpleForm, FormGroup
- CheckboxList
Comentarios
- Alert, Callout
- Toast, Flash
- Modal, DialogService
- Loader
Visualización de datos
- Table, TableResponsive
- Card, Stat
- Badge, BadgeGroup
- Code, CodeBlock
Navegación
- Tabs
- CommandPalette
- Pager
- SettingsPanel
Interactivo
- Button, ButtonGroup
- Tooltip, Popover
- Popconfirm
- Timeline
Explore the sidebar navigation to see detailed examples and documentation for each component.
Próximos pasos
Browse the Components Overview to see all available components with live examples.
See the CoreComponents Migration guide for a full mapping from Phoenix defaults.