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
MatTheme.indigo.headers()- Loads BeerCSS with the indigo color schemeCard- Creates a Material Design card component with elevationFormField- Generates a styled input with floating labelButton- 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
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
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
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
8d0b1c0672d1b58357d490649bfd676fe40c0adf9fdf51c6075e9c2f84249d46
|
|
| MD5 |
330987d7f5fcc3502e208a4ca659bee3
|
|
| BLAKE2b-256 |
cc8c3add5bb9d40ebbda1b82f12baabe47b4bcdbf2c11335e42ddca4af63e8a5
|
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
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
f7147e8773adcc84de3dbb20025d52b48b884bdf110192b84a8d74f6602d92b9
|
|
| MD5 |
f9f60198356f51a630b6b2cfc4ca3bf6
|
|
| BLAKE2b-256 |
f3b9ec7f41f3245b9307498dd45ef03b8d481069af91ff43069f52dad3b61284
|