Skip to main content

fasthtml-basecoat

FastHTML components built on top of Basecoat CSS. They have the clean, familiar look of shadcn, without bringing React into your app.

Try the components

Visit fasthtml-basecoat.jonasfrei.de to explore the components in the browser. Every example also links to the source code below, so you can see how it is put together.

Getting started

Basecoat uses Tailwind. Install the Python package and the small frontend build setup:

uv add fasthtml-basecoat
# or
pip install fasthtml-basecoat

npm install basecoat-css tailwindcss
npm install --save-dev @tailwindcss/cli

Create styles/tailwind.css:

@import "tailwindcss";
@import "basecoat-css";

This tells Tailwind to look for classes in your Python files. Build the stylesheet into FastHTML's static directory:

npx @tailwindcss/cli -i ./styles/tailwind.css -o ./static/css/app.css

Use the generated stylesheet in your app. BasecoatJS() adds the JavaScript needed by interactive components.

from fasthtml.common import Link, fast_app

from fasthtml_basecoat import BasecoatJS
from fasthtml_basecoat.components.button import Button

app, rt = fast_app(
    hdrs=(
        Link(rel="stylesheet", href="/static/css/app.css"),
        BasecoatJS(),
    )
)


@rt("/")
def get():
    return Button("Hello", cls="w-full")

Run your app as usual and open it in the browser. Import the other components you need and use them like normal FastHTML elements.

Components and examples

The live component gallery is the quickest way to browse what is available. The links below go straight to the working showcase source for each component.

Component Description
Accordion Expandable sections of content.
Alert Callouts for important information.
Alert Dialog A dialog for important decisions that need a response.
Avatar Profile images with a fallback.
Badge Small labels for status or categories.
Breadcrumb Navigation that shows where someone is in your app.
Button Buttons with common variants, sizes, and icons.
Button Group Related buttons grouped together.
Card Content containers with optional header, body, and footer.
Checkbox Checkboxes for forms and settings.
Combobox Searchable input with suggestions.
Command Command menus for quick actions and navigation.
Dialog Modal windows for focused tasks.
Drawer Panels that slide in from an edge of the screen.
Dropdown Menu Menus opened from a button.
Empty Empty states with an icon, message, and optional action.
Form Composition Labels, controls, and help text for native forms.
Input Group Inputs and textareas with extra information or actions.
Item Flexible rows for displaying content.
Kbd Keyboard shortcuts and key labels.
Native Select A styled native select control.
Pagination Page navigation controls.
Popover Content that opens next to a trigger.
Progress Progress indicators.
Radio Group A group where one option can be selected.
Scroll Area Styled scrolling content areas.
Select Custom select menus.
Sidebar Flexible application sidebars.
Skeleton Loading placeholders.
Slider Range inputs.
Spinner Loading indicators.
Switch On/off controls.
Table Responsive tables.
Tabs Sections that switch between related content.
Textarea Multi-line text inputs.
Theme Switcher Light and dark mode controls.
Toast Brief messages that disappear automatically.
Tooltip Helpful text shown on hover or keyboard focus.

The repository includes the gallery used for the online showcase. It builds a local Basecoat stylesheet before starting the FastHTML app.

npm ci
npm run build
uv run app.py

Open http://localhost:5001 in your browser. The generated stylesheet is served from /static/css/basecoat.css and is not committed to the repository. Basecoat’s JavaScript bundle is loaded from jsDelivr, so interactive components need network access.

To build and run the gallery in a container:

docker build -t fasthtml-basecoat .
docker run --rm -p 5001:5001 fasthtml-basecoat

Development

Install the Python and frontend development dependencies:

uv sync --extra dev
npm ci

Run the checks and build the distributable package:

uv run ruff check .
uv run ruff format --check .
uv build

Metadata

Release files for fasthtml-basecoat 0.1.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for fasthtml-basecoat 0.1.0
File Size Uploaded
fasthtml_basecoat-0.1.0.tar.gz 38.4 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for fasthtml-basecoat 0.1.0
File Interpreter ABI Platform
fasthtml_basecoat-0.1.0-py3-none-any.whl Python 3 none any Details

Total release size: 111.6 kB

Release files / fasthtml_basecoat-0.1.0.tar.gz

Download URL fasthtml_basecoat-0.1.0.tar.gz
Size 38.4 kB
Tags Source
SHA-256 checksum
How to use checksums
93d19912c1c918adbe9986f9b4cf8e5f683ec9a260e6fca42cb1d2e22b4d3cb9
BLAKE2b-256 checksum
How to use checksums
83fd6057a25b6f2ca6a4fe6b524aadfb676681bfe2cd2a0ca6fefa9a61925f6d
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.14.4

Release files / fasthtml_basecoat-0.1.0-py3-none-any.whl

Download URL fasthtml_basecoat-0.1.0-py3-none-any.whl
Size 73.2 kB
Tags Python 3
SHA-256 checksum
How to use checksums
96968137506171771b25e58220824ef9d3b9625588fdb0e644a3fb835b8716e8
BLAKE2b-256 checksum
How to use checksums
e1e807d86db4d7233c674e9b9d33a3c570571f867f5b186b7d53d385bd793511
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.14.4

Release history Release notifications | RSS feed

This release

0.1.0 This release

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page