Skip to main content

material-ui for fasthtml

Project description

What is fh-matui?

fh-matui is a Python library that brings Google's Material Design to FastHTML applications. It provides a comprehensive set of pre-built UI components that integrate seamlessly with FastHTML's hypermedia-driven architecture.

Built on top of BeerCSS (a lightweight Material Design 3 CSS framework), fh-matui enables you to create modern, responsive web interfaces entirely in Python โ€” no JavaScript required.

โœจ Key Features

Feature Description
๐ŸŽจ Material Design 3 Modern, beautiful components following Google's latest design language
โšก Zero JavaScript Build interactive UIs entirely in Python with FastHTML
๐Ÿ“ฑ Responsive Mobile-first design with automatic breakpoint handling
๐ŸŒ™ Dark Mode Built-in light/dark theme support with 20+ color schemes
๐Ÿงฉ Composable Chainable styling APIs inspired by MonsterUI
๐Ÿ“Š Data Tables Full-featured tables with pagination, search, sorting, and CRUD
๐Ÿ”ง nbdev-powered Literate programming with documentation built from notebooks

๐Ÿ—๏ธ Architecture

โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”
โ”‚                        fh-matui                              โ”‚
โ”œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ค
โ”‚  Foundations     โ”‚  Core styling utilities, helpers, enums  โ”‚
โ”‚  Core            โ”‚  Theme system, MatTheme color presets    โ”‚
โ”‚  Components      โ”‚  Buttons, Cards, Modals, Forms, Tables   โ”‚
โ”‚  App Pages       โ”‚  Full-page layouts, navigation patterns  โ”‚
โ”‚  Data Tables     โ”‚  DataTable, DataTableResource for CRUD   โ”‚
โ”‚  Web Pages       โ”‚  Landing pages, marketing components     โ”‚
โ”œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ค
โ”‚  BeerCSS         โ”‚  Material Design 3 CSS framework         โ”‚
โ”‚  FastHTML        โ”‚  Python hypermedia web framework         โ”‚
โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜

๐ŸŽจ Available Themes

fh-matui includes 15+ pre-configured Material Design 3 color themes:

Theme Preview Theme Preview
MatTheme.red ๐Ÿ”ด MatTheme.pink ๐Ÿฉท
MatTheme.purple ๐ŸŸฃ MatTheme.deepPurple ๐Ÿ’œ
MatTheme.indigo ๐Ÿ”ต MatTheme.blue ๐Ÿ’™
MatTheme.lightBlue ๐Ÿฉต MatTheme.cyan ๐ŸŒŠ
MatTheme.teal ๐Ÿฉถ MatTheme.green ๐Ÿ’š
MatTheme.lightGreen ๐Ÿ€ MatTheme.lime ๐Ÿ’›
MatTheme.yellow ๐ŸŒŸ MatTheme.amber ๐Ÿงก
MatTheme.orange ๐ŸŸ  MatTheme.deepOrange ๐Ÿ”ถ

Usage:

# Choose your theme
app, rt = fast_app(hdrs=[MatTheme.deepPurple.headers()])

๐Ÿš€ Quick Start

Here's a minimal example to get you started:

from fasthtml.common import *
from fh_matui.core import MatTheme
from fh_matui.components import Button, Card, FormField

# Create a themed FastHTML app
app, rt = fast_app(hdrs=[MatTheme.indigo.headers()])

@rt('/')
def home():
    return Div(
        Card(
            H3("Welcome to fh-matui!"),
            P("Build beautiful Material Design apps with Python."),
            Button("Get Started", cls="primary"),
        ),
        cls="padding"
    )

serve()

๐Ÿ“ฆ Installation

pip install fh-matui

Dependencies

fh-matui automatically includes:

  • python-fasthtml - The core FastHTML framework
  • BeerCSS - Loaded via CDN for Material Design 3 styling

What This Code Does

  1. MatTheme.indigo.headers() - Loads BeerCSS with the indigo color scheme
  2. Card - Creates a Material Design card component with elevation
  3. FormField - Generates a styled input with floating label
  4. Button - Renders a Material Design button with ripple effects

๐Ÿ“š Module Reference

Module Description Key Components
Foundations Base utilities and helper functions BeerHeaders, display, styling helpers
Core Theme system and styling MatTheme, color presets, theme configuration
Components UI component library Button, Card, FormField, FormModal, Grid
App Pages Application layouts Navigation, sidebars, full-page layouts
Data Tables Data management components DataTable, DataTableResource, CRUD operations
Web Pages Marketing/landing pages Hero sections, feature grids, testimonials

๐Ÿ› ๏ธ Development

Install in Development Mode

# Clone the repository
git clone https://github.com/user/fh-matui.git
cd fh-matui

# Install in editable mode
pip install -e .

# Make changes under nbs/ directory, then compile
nbdev_prepare

๐Ÿค Why fh-matui?

Challenge fh-matui Solution
CSS complexity Pre-built Material Design 3 components via BeerCSS
JavaScript fatigue FastHTML handles interactivity declaratively
Component consistency Unified API across all components
Dark mode support Built-in with automatic system preference detection
Responsive design Mobile-first grid system and responsive utilities
Form handling FormField, FormGrid, FormModal for rapid form building
Data management DataTable and DataTableResource for CRUD operations

๐Ÿ“„ License

This project is licensed under the Apache 2.0 License - see the LICENSE file for details.


Built with โค๏ธ using FastHTML and nbdev

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

fh_matui-0.9.4.tar.gz (47.8 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

fh_matui-0.9.4-py3-none-any.whl (46.6 kB view details)

Uploaded Python 3

File details

Details for the file fh_matui-0.9.4.tar.gz.

File metadata

  • Download URL: fh_matui-0.9.4.tar.gz
  • Upload date:
  • Size: 47.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.13.5

File hashes

Hashes for fh_matui-0.9.4.tar.gz
Algorithm Hash digest
SHA256 3e3a14309e37d1c484a8f0759dee0440062259a19e70ff57025747a973a56c8e
MD5 b05f68852784219bfb946849d8975f78
BLAKE2b-256 55c8244be5792e9ff238ad1c388b6e3d5dc829514580463d11b4b62affc06e12

See more details on using hashes here.

File details

Details for the file fh_matui-0.9.4-py3-none-any.whl.

File metadata

  • Download URL: fh_matui-0.9.4-py3-none-any.whl
  • Upload date:
  • Size: 46.6 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.13.5

File hashes

Hashes for fh_matui-0.9.4-py3-none-any.whl
Algorithm Hash digest
SHA256 64c4a3b11884650e2352304ce701e3edfb1eb6980de251bdae8e0418682f4cd9
MD5 f516b584d5469f3f992982d9566975a7
BLAKE2b-256 2623b6104d0228fb6c661968e43457c043f242018048548e41e6c26d3030f884

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page