{# app/templates/admin/components.html #} {% extends "admin/base.html" %} {% block title %}UI Components{% endblock %} {# ✅ CRITICAL: Link to Alpine.js component #} {% block alpine_data %}adminComponents(){% endblock %} {% block extra_head %} {# Chart.js for charts section #} {% endblock %} {% block content %}
Copy-paste ready UI components for your admin pages. All components support dark mode and are fully accessible.
Shop Components: Reusable e-commerce components from shared/macros/shop/. These support vendor theming via CSS variables and are designed for the shop frontend.
Product cards with badges, ratings, wishlist
product_card(), product_badge()
Responsive product grid with loading states
product_grid(), product_skeleton()
Add to cart buttons and forms
add_to_cart_button(), add_to_cart_form()
Cart dropdown, cart items, summary
mini_cart(), cart_item(), cart_summary()
Versatile product cards with badges, ratings, wishlist, and quick-add functionality. Supports sm, md, and lg sizes.
Standardized add to cart buttons with loading states. Integrates with number_stepper for quantity selection.
Reusable Components: Use Jinja macros from shared/macros/ instead of copy-pasting HTML. This ensures consistency and makes updates easier.
Table pagination with page numbers
pagination(), pagination_simple()
Alerts, loading states, toasts
loading_state(), error_state(), alert(), toast()
Status badges and indicators
badge(), status_badge(), verification_badge(), role_badge()
Button variants and action buttons
btn_primary(), btn_secondary(), action_button()
Form inputs with validation
form_input(), form_select(), form_textarea()
Table components and empty states
table_wrapper(), table_header(), table_empty_state()
Stat cards and info cards
stat_card(), card(), info_card(), coming_soon_card()
Page headers and breadcrumbs
page_header(), section_header(), breadcrumbs()
Tab navigation components
tabs_nav(), tabs_inline(), tab_button()
Specialized input components
search_autocomplete(), number_stepper()
{# Import at the top of your template #}
{% raw %}{% from 'shared/macros/pagination.html' import pagination %}
{% from 'shared/macros/alerts.html' import loading_state, error_state %}
{% from 'shared/macros/badges.html' import status_badge, verification_badge %}
{% from 'shared/macros/buttons.html' import btn_primary, action_button %}
{% from 'shared/macros/cards.html' import stat_card %}
{% from 'shared/macros/headers.html' import page_header %}
{# Then use in your template #}
{{ page_header('User Management', action_label='Create User', action_url='/users/create') }}
{{ loading_state('Loading users...') }}
{{ error_state('Error loading users') }}
{# In your table #}
{{ pagination() }}{% endraw %}
A number input with +/- buttons. Use number_stepper() from inputs.html. Supports size variants and min/max bounds.
Use the pagination() macro. Requires Alpine.js properties: pagination, startIndex, endIndex, totalPages, pageNumbers.
Use pagination_simple() for a simpler prev/next navigation.
Jinja Macros Available: Use the tabs_nav, tabs_inline, and tab_button macros from shared/macros/tabs.html.
Standalone tabs for page-level navigation. Use tabs_nav() with tab_button().
Dashboard content goes here...
Settings content goes here...
Profile content goes here...
Compact tabs for use inside cards or alongside other elements. Use tabs_inline().
When you need to run additional logic on tab change (e.g., load data), use the onclick parameter.
{% raw %}{% from 'shared/macros/tabs.html' import tabs_nav, tab_button %}
{# Tabs with custom click handlers and different tab variable #}
{% call tabs_nav() %}
{{ tab_button('database', 'Database Logs',
tab_var='logSource',
icon='database',
onclick="logSource = 'database'; loadDatabaseLogs()") }}
{{ tab_button('file', 'File Logs',
tab_var='logSource',
icon='document',
onclick="logSource = 'file'; loadFileLogs()") }}
{% endcall %}{% endraw %}
This is a basic card component with a title and description.
| Name | Status | |
|---|---|---|
| John Doe | john@example.com | Active |
| Jane Smith | jane@example.com | Pending |
Are you sure you want to perform this action? This cannot be undone.
Charts are provided by Chart.js . Note that default legends are disabled and you should provide descriptions for your charts in HTML.