Lightweight UI components for building FastHTML applications.
Project details
Faststrap enhances FastHTML by offering 179 reusable UI components that cater to web apps, dashboards, and data tools with Bootstrap styling. Designed for Python developers, it simplifies building polished interfaces while keeping dependencies minimal. The integration of HTMX provides intelligent features like lazy loading and polling, ensuring a seamless user experience.
Faststrap is a powerful Python-native extension designed for creating user interfaces in FastHTML applications. Targeted towards Python developers, it serves as a comprehensive toolkit for building production-ready web apps, dashboards, and AI-ready interfaces with ease and efficiency.
Comprehensive UI Components: Faststrap provides 179 registered UI components, including forms, navigation menus, modals, notifications, and customizable layouts. Designed with Bootstrap 5 styling, these components are both lightweight and visually appealing.
Dynamic Data Handling: Enhance web applications with data-centric tools like DataTable, metric cards, charts, maps, and server-sent events (SSE) seamlessly integrated.
HTMX Integration: Faststrap supports full HTMX capabilities, allowing for dynamic updates without the need for page reloads. It includes HTMX presets modules that offer ready-to-use patterns for interactions like lazy loading and optimistic actions.
SEO and Progressive Web App (PWA) Support: Built-in modules assist with SEO best practices, including structured data and Open Graph tags, while PWA support ensures that applications can be installed as apps on devices, complete with offline capabilities.
Custom Themes and Zero JavaScript: Create beautiful themes easily without requiring extensive JavaScript knowledge. Faststrap's components function as expected right out of the box.
Built-in Dark Mode: Automatically switch between light and dark themes, enhancing user experience based on their preferences.
Interactive Component Preview Studio: A fully offline interactive studio for testing and previewing components in real time, providing a hands-on approach to UI development.
Here’s a simple example to demonstrate how Faststrap can be utilized to create an engaging user interface:
from fasthtml.common import FastHTML, serve
from faststrap import add_bootstrap, Card, Button, create_theme
app = FastHTML()
# Define a custom theme
theme = create_theme(primary="#7BA05B", secondary="#48C774")
add_bootstrap(app, theme=theme, mode="dark")
@app.route("/")
def home():
return Card(
"Welcome to FastStrap! Build beautiful UIs in pure Python.",
header="Hello World!",
footer=Button("Get Started", variant="primary")
)
serve()
This snippet showcases how to effortlessly create a beautiful web application with a card and button component, requiring no JavaScript at all.
Faststrap has comprehensive documentation that guides users through the various components, offering detailed examples and best practices. For additional resources, guidance, or to engage with the community, visit the documentation site or join the FastHTML community on Discord.
Comments
0Start the conversation
Share the first comment.