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."),
            FormField("email", label="Email", type="email"),
            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.2.tar.gz (47.3 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.2-py3-none-any.whl (46.0 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: fh_matui-0.9.2.tar.gz
  • Upload date:
  • Size: 47.3 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.2.tar.gz
Algorithm Hash digest
SHA256 8d0b1c0672d1b58357d490649bfd676fe40c0adf9fdf51c6075e9c2f84249d46
MD5 330987d7f5fcc3502e208a4ca659bee3
BLAKE2b-256 cc8c3add5bb9d40ebbda1b82f12baabe47b4bcdbf2c11335e42ddca4af63e8a5

See more details on using hashes here.

File details

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

File metadata

  • Download URL: fh_matui-0.9.2-py3-none-any.whl
  • Upload date:
  • Size: 46.0 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.2-py3-none-any.whl
Algorithm Hash digest
SHA256 f7147e8773adcc84de3dbb20025d52b48b884bdf110192b84a8d74f6602d92b9
MD5 f9f60198356f51a630b6b2cfc4ca3bf6
BLAKE2b-256 f3b9ec7f41f3245b9307498dd45ef03b8d481069af91ff43069f52dad3b61284

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