{# 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 %}

UI Components Library

Back to Dashboard

Quick Reference Library

Copy-paste ready UI components for your admin pages. All components support dark mode and are fully accessible.

E-commerce Components

Shop Components: Reusable e-commerce components from shared/macros/shop/. These support vendor theming via CSS variables and are designed for the shop frontend.

Available Shop Macro Files

product-card.html

Product cards with badges, ratings, wishlist

product_card(), product_badge()

product-grid.html

Responsive product grid with loading states

product_grid(), product_skeleton()

add-to-cart.html

Add to cart buttons and forms

add_to_cart_button(), add_to_cart_form()

mini-cart.html

Cart dropdown, cart items, summary

mini_cart(), cart_item(), cart_summary()

Product Cards

Versatile product cards with badges, ratings, wishlist, and quick-add functionality. Supports sm, md, and lg sizes.

Mini Cart

Cart icon button with badge and dropdown preview. Click the cart icon to see the dropdown.

Shopping Cart

Your cart is empty

Subtotal

Add to Cart Button

Standardized add to cart buttons with loading states. Integrates with number_stepper for quantity selection.

Added to cart!

Product Gallery

Image gallery with thumbnails, navigation, zoom on hover, and fullscreen lightbox.

{# Main Image #}
{# Navigation Arrows #}
{# Thumbnails #}

Variant Selector

Product variant selection with button groups and color swatches. Supports out-of-stock indicators.

{# Size Selector #}
{# Color Swatches #}

Product Info

Product details section with title, price, rating, stock status, and description.

{# Category / Vendor #}
Sold by
{# Title #}

{# Rating #}
( reviews)
{# Price #}
{# Description #}

{# Stock Status #}
In Stock

Product Tabs

Tabbed content for product description, specifications, reviews, and shipping info.

{# Tab Navigation #}
{# Tab Content #}
{# Description Tab #}

Key Features

{# Specifications Tab #}
{# Reviews Tab #}

Category Navigation

Sidebar navigation with nested categories, collapsible sections, and active state tracking.

{# Sidebar Navigation #}

Sidebar Navigation

{# Horizontal Category Menu #}

Horizontal Pills

Breadcrumbs

Navigation trail showing category hierarchy with home link, separator icons, and current page indicator.

{# Standard Breadcrumbs #}

Standard Breadcrumbs

{# Compact Breadcrumbs #}

Compact (Mobile-friendly)

Search Bar

Product search with autocomplete, recent searches, popular suggestions, and mobile-optimized full-screen search.

{# Basic Search #}

Basic Search

{# Search with Button #}

With Search Button

{# Autocomplete Search #}

With Autocomplete Dropdown

Recent Searches
Popular Searches

Filter Sidebar

Product filtering with price range, categories, brands, colors, sizes, ratings, and availability.

{# Filter Sidebar #}

Filters

{# Categories #}
Categories
{# Price Range #}
Price Range
$
-
$
{# Availability #}
{# Color & Size Filters #}

Attribute Filters

{# Colors #}
Color
{# Sizes #}
Size
{# Rating & Sort #}

Rating & Sort

{# Rating Filter #}
Rating
{# Sort Dropdown #}
Sort By
{% from 'shared/macros/shop/star-rating.html' import star_rating, rating_input, rating_summary, compact_rating %}

Star Rating

Flexible star rating components for displaying and collecting ratings.

Static Ratings

Full Stars

{{ star_rating(rating=4) }}

Half Stars

{{ star_rating(rating=4.5) }}

Exact Precision

{{ star_rating(rating=3.7, precision='exact') }}

With Value

{{ star_rating(rating=4.5, show_value=true) }}

With Count

{{ star_rating(rating=4.5, show_count=true, count=127) }}

Sizes

{{ star_rating(rating=4, size='xs') }} {{ star_rating(rating=4, size='sm') }} {{ star_rating(rating=4, size='md') }} {{ star_rating(rating=4, size='lg') }}

Dynamic Rating (Alpine.js)

Adjust rating:
{{ star_rating(rating_var='demoRating', show_value=true, show_count=true, count_var='demoReviewCount') }}

Compact Rating

Extra Small

{{ compact_rating(rating=4.5, count=127, size='xs') }}

Small

{{ compact_rating(rating=4.5, count=127, size='sm') }}

Medium

{{ compact_rating(rating=4.5, count=127, size='md') }}

Interactive Rating Input

Standard Input

{{ rating_input(model='demoUserRating', size='md') }}

Large with Half Stars

{{ rating_input(model='demoUserRating', size='lg', allow_half=true) }}

Rating Summary

{{ rating_summary(rating_var='demoRating', count_var='demoReviewCount', distribution_var='demoRatingDistribution') }}
{% from 'shared/macros/shop/reviews.html' import review_card, review_list, review_form, review_summary_section %}

Reviews

Complete review system with cards, lists, forms, and summary sections.

Review Card

Review Summary Section

{{ review_summary_section( rating_var='demoRating', count_var='demoReviewCount', distribution_var='demoRatingDistribution', on_write='showReviewForm = true' ) }}

Review Form

{{ review_form( rating_model='demoNewReview.rating', title_model='demoNewReview.title', content_model='demoNewReview.content', images_model='demoNewReview.images', on_submit='demoSubmitReview()', submitting_var='submittingReview' ) }}
{% from 'shared/macros/shop/trust-badges.html' import trust_badges, trust_banner, payment_icons, guarantee_badge, security_seals, checkout_trust_section %}

Trust Badges

Trust signals and security indicators to build customer confidence.

Trust Badges

{{ trust_badges(badges=['secure_payment', 'free_shipping', 'easy_returns', 'support_24_7'], layout='grid', size='md') }}

Trust Banner

{{ trust_banner(variant='detailed') }}

Payment Icons

All Methods

{{ payment_icons(methods=['visa', 'mastercard', 'paypal', 'apple_pay', 'google_pay', 'amex']) }}

With Label

{{ payment_icons(methods=['visa', 'mastercard', 'paypal'], size='lg') }}

Guarantee Badges

Money Back

{{ guarantee_badge(type='money_back', days=30) }}

Satisfaction

{{ guarantee_badge(type='satisfaction', variant='filled') }}

Security Seals

{{ security_seals(seals=['ssl', 'secure_checkout', 'verified']) }}

Checkout Trust Section

{{ checkout_trust_section() }}

Jinja Macros

Reusable Components: Use Jinja macros from shared/macros/ instead of copy-pasting HTML. This ensures consistency and makes updates easier.

Available Macro Files

pagination.html

Table pagination with page numbers

pagination(), pagination_simple()

alerts.html

Alerts, loading states, toasts

loading_state(), error_state(), alert(), toast()

badges.html

Status badges and indicators

badge(), status_badge(), verification_badge(), role_badge()

buttons.html

Button variants and action buttons

btn_primary(), btn_secondary(), action_button()

forms.html

Form inputs with validation

form_input(), form_select(), form_textarea()

tables.html

Table components and empty states

table_wrapper(), table_header(), table_empty_state()

cards.html

Stat cards and info cards

stat_card(), card(), info_card(), coming_soon_card()

headers.html

Page headers and breadcrumbs

page_header(), section_header(), breadcrumbs()

tabs.html

Tab navigation components

tabs_nav(), tabs_inline(), tab_button()

inputs.html

Specialized input components

search_autocomplete(), number_stepper()

language_selector.html

Language/i18n components

language_selector(), language_selector_compact(), language_toggle()

Usage Example

{# 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 %}

Number Stepper

A number input with +/- buttons. Use number_stepper() from inputs.html. Supports size variants and min/max bounds.

Language Selector

Language selector components for multi-language support. Use macros from language_selector.html. Supports dropdown, compact (icon-only), and toggle variants.

{% from 'shared/macros/language_selector.html' import language_selector %} {{ language_selector(current_language='fr', enabled_languages=['en', 'fr', 'de', 'lb'], position='left') }}
{% from 'shared/macros/language_selector.html' import language_selector_compact %} {{ language_selector_compact(current_language='de', enabled_languages=['en', 'fr', 'de'], position='left') }}
{% from 'shared/macros/language_selector.html' import language_toggle %} {{ language_toggle(current_language='fr', enabled_languages=['fr', 'de']) }}
{% raw %}{% from 'shared/macros/language_selector.html' import language_selector, language_selector_compact, language_toggle %}

{# Full dropdown with labels #}
{{ language_selector(
    current_language='fr',
    enabled_languages=['en', 'fr', 'de', 'lb'],
    position='right'
) }}

{# Compact (flag icon only) - good for headers #}
{{ language_selector_compact(
    current_language='fr',
    enabled_languages=['en', 'fr', 'de'],
    position='right'
) }}

{# Toggle for 2 languages #}
{{ language_toggle(
    current_language='fr',
    enabled_languages=['fr', 'de']
) }}{% endraw %}

Pagination

Full Pagination (with page numbers)

Use the pagination() macro. Requires Alpine.js properties: pagination, startIndex, endIndex, totalPages, pageNumbers.

Showing 1-10 of 97

Simple Pagination (prev/next only)

Use pagination_simple() for a simpler prev/next navigation.

Showing 1-10 of 97 results
Page 1 of 10

Tabs

Jinja Macros Available: Use the tabs_nav, tabs_inline, and tab_button macros from shared/macros/tabs.html.

Navigation Tabs (with icons)

Standalone tabs for page-level navigation. Use tabs_nav() with tab_button().

Dashboard content goes here...

Settings content goes here...

Profile content goes here...

Inline Tabs (with count badges)

Compact tabs for use inside cards or alongside other elements. Use tabs_inline().

Search or filters here...

Tabs with Custom Click Handlers

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 %}

Forms

Basic Input

Required Field with Error

Textarea

Select

Buttons

Primary Button

Secondary Button

Danger Button

Cards

Basic Card

Card Title

This is a basic card component with a title and description.

Badges

Status Badges

Active Pending Inactive Info

Tables

Basic Table

Name Email Status
John Doe john@example.com Active
Jane Smith jane@example.com Pending

Modals

Confirmation Modal

Confirm Action

Are you sure you want to perform this action? This cannot be undone.

Confirmation Modal Macros

Use the confirm_modal and confirm_modal_dynamic macros for styled confirmation dialogs. These support danger, warning, and info variants.

{# Static Confirm Modal Demo #}
{# Confirm Modal Demo (Danger) #} {# Confirm Modal Demo (Warning) #} {# Confirm Modal Demo (Info) #} {# Dynamic Confirm Modal Demo #}

Static Message (confirm_modal):

Dynamic Message (confirm_modal_dynamic):

Parameters: id, title, message (or message_var for dynamic), confirm_action, show_var, confirm_text, cancel_text, variant ('danger'|'warning'|'info'), icon

Details Modal (Table Layout)

Pattern for displaying record details with a header (icon + badge), table layout, and optional sections. Used for Job Details, Log Details, etc.

{# Modal Header with Icon and Badge #}

Record Details

ID: 12345

Completed
{# Modal Body #}
{# Stats Cards Row #}

150

Imported

25

Updated

2

Errors

177

Total

{# Details Table #}
Owner
Acme Corp
Created
Dec 11, 2024 14:30
Source
api/products.csv
{# Modal Footer #}

Usage: See app/templates/shared/macros/modals.htmljob_details_modal for full implementation.

Log Details Modal

Specialized modal for displaying log entries with level-based styling, message section, exception display, and stack trace with copy functionality.

{# Modal Header with Level Badge #}

Log Entry Details

ID:

{# Modal Body #}
{# Details Table #}
Timestamp
Logger
Module
{# Message Section #}

Message

{# Exception Section (conditional) #}

Exception

{# Stack Trace Section (conditional) #}

Stack Trace

{# Modal Footer #}

Usage: See app/templates/admin/logs.html for full implementation.

Alerts

Toast Notifications

Charts

Charts are provided by Chart.js . Note that default legends are disabled and you should provide descriptions for your charts in HTML.

Doughnut/Pie Chart

Shoes
Shirts
Bags

Line Chart

Organic
Paid

Bar Chart

Shoes
Bags
{% endblock %} {% block extra_scripts %} {# ✅ CRITICAL: Load JavaScript file #} {% endblock %}