Skip to main content

FastBlocks UI

Code style: crackerjack Runtime: oneiric uv Python: 3.13+

FastBlocks UI is a modern HTML/CSS-first UI layer with a stable ui-* namespace, Jinja/FastBlocks helpers, and optional enhancement JavaScript. It is the successor to the archived fastbulma project and is built as a clean-slate system with no compatibility bridge and no Sass/build-tool requirement.

Features

  • HTML/CSS First: Uses semantic markup, CSS variables, and cascade layers as the foundation
  • Template Helpers: Ships Python helpers for Jinja, async Jinja, and FastBlocks rendering
  • htmx Safe: Keeps IDs, form fields, and interaction state in normal light DOM markup
  • Optional Enhancement JS: Keeps behavior light and progressive-enhancement friendly
  • Modern Styling: Uses a Tailwind-inspired semantic token baseline with custom visuals
  • Permissive License: BSD-3-Clause for commercial and open-source use

Component Model

FastBlocks UI components are standard HTML patterns with ui-* classes and helper-backed server rendering. The v1 runtime does not register Custom Elements and does not use shadow DOM by default. htmx targets, triggers, and swapped regions should remain normal light DOM nodes so the server stays authoritative for selected tabs, open menus, form state, and validation state.

Optional light-DOM Custom Elements such as <ui-tabs>, <ui-dialog>, and <ui-menu> are available as opt-in wrappers around the canonical helper output and are tracked in docs/light-dom-custom-elements-spec.md.

Installation

Install using pip:

pip install fastblocks-ui

Then copy the assets to your project:

fastblocks-ui copy-assets --dest ./static

Usage

Once installed, you can use the ui-* classes and Python helpers with server-rendered HTML:

<div class="ui-card">
  <div class="ui-card__header">Card Title</div>
  <div class="ui-card__body">
    This is a FastBlocks UI card styled with semantic tokens.
  </div>
  <footer class="ui-card__footer">
    <button class="ui-button is-primary" type="button">Action</button>
  </footer>
</div>

For full examples covering sync Jinja, async Jinja, and htmx fragments, see docs/usage.md. The component manifest is documented in docs/components.md. PWA-friendly app integration notes live in docs/pwa.md. Theming recipes live in docs/theming-recipes.md.

Template Examples

Sync Jinja

{{ button("Save changes", variant="primary", type="submit") }}

Async Jinja

template = env.get_template("profile.html")
html = await template.render_async(user=user, button=button)

htmx Fragment

<form id="profile-form" hx-post="/profile" hx-target="#profile-form" hx-swap="outerHTML">
  {{ field(
    label="Email address",
    control_html=ui_input(id="profile-email", name="email", type="email", value=user.email)
  ) }}
  {{ button("Save", variant="primary", type="submit") }}
</form>

Demo

A self-contained showcase of every component (light + dark) is generated from the Python helpers:

python scripts/build_demo.py        # writes demo/index.html
open demo/index.html                # or serve the demo/ directory

The page inlines the CSS bundle and the enhance.js behavior layer, so it runs as a single file with no build step or server required.

Theming

FastBlocks UI enables flexible theming through CSS variables:

:root {
  --ui-color-primary: #e040fb;
  --ui-radius-md: 8px;
  --ui-color-success: #00c853;
}

FastBlocks UI components automatically inherit these changes through semantic token mapping.

Components

FastBlocks UI centers its public surface on ui-* classes and helper APIs:

Layout Components

  • ui-container / container() - Centered max-width container
  • ui-columns / columns() - 12-column responsive grid
  • ui-column / column() - Individual column in grid
  • ui-section / section() - Vertical spacing container
  • ui-footer / footer() - Page footer
  • ui-level / level() - Horizontal toolbar/nav
  • ui-hero / hero() - Full-width banner section
  • ui-title / title() - Typography title
  • ui-media / media() - Image + text pair
  • ui-tile / tile() - Hierarchical tile layout

UI Components

  • ui-button / button() - Buttons
  • ui-card / card() - Cards
  • ui-field / field() - Form groups
  • ui-input / input() - Form inputs
  • ui-select / select() - Select dropdowns
  • ui-checkbox / checkbox() - Checkboxes
  • ui-switch / switch() - Toggle switches
  • ui-dialog / dialog() - Modal dialogs
  • ui-tabs / tabs() - Tabbed interfaces
  • ui-menu / menu() - Menus
  • ui-alert / alert() - Alerts

License

BSD-3-Clause

Download files

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

Source Distribution

fastblocks_ui-0.7.0.tar.gz (54.2 kB view details)

Uploaded Source

Built Distribution

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

fastblocks_ui-0.7.0-py3-none-any.whl (58.3 kB view details)

Uploaded Python 3

File details

Details for the file fastblocks_ui-0.7.0.tar.gz.

File metadata

  • Download URL: fastblocks_ui-0.7.0.tar.gz
  • Upload date:
  • Size: 54.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.11.32 {"installer":{"name":"uv","version":"0.11.32","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"macOS","version":null,"id":null,"libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}

File hashes

Hashes for fastblocks_ui-0.7.0.tar.gz
Algorithm Hash digest
SHA256 3175e3588cdc155759d9d2d8bf3a0505445cf8d96d3d48420099d612b61607b9
MD5 f2224913231fa38b11ff2b28d8c50f39
BLAKE2b-256 2a90da87f7e0f2963cefa38c132d7946d044918ca04412786233deb4f561a31b

See more details on using hashes here.

File details

Details for the file fastblocks_ui-0.7.0-py3-none-any.whl.

File metadata

  • Download URL: fastblocks_ui-0.7.0-py3-none-any.whl
  • Upload date:
  • Size: 58.3 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.11.32 {"installer":{"name":"uv","version":"0.11.32","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"macOS","version":null,"id":null,"libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}

File hashes

Hashes for fastblocks_ui-0.7.0-py3-none-any.whl
Algorithm Hash digest
SHA256 700d0ebad3de53ba34065c5d1351422064d37dd752fbf26e8dbacc2b33485a01
MD5 3a09cf760615e09aba2286d0b4d7ef45
BLAKE2b-256 9c95380f93dfbf9b163e2f151eb3d732ffcebc42e767a9016c9797fa0d5adfaa

See more details on using hashes here.

Release history Release notifications | RSS feed

0.9.0

2 files

0.8.1

2 files

0.8.0

2 files

0.7.1

2 files

This release

0.7.0 This release

2 files

0.5.0

2 files

0.4.1

2 files

0.4.0

2 files

Supported by

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