Skip to main content

Named UI role recipes (panels, chrome, insets) for FastHTML applications — a stable abstraction layer over DaisyUI and Tailwind primitives.

Project description

cjm-fasthtml-design-system

Install

pip install cjm_fasthtml_design_system

Role in the Multi-Workflow Pipeline

This library sits between UI-bearing consumer libraries and the underlying styling primitives:

Consumers (page-centric libraries, host apps, demo apps)
    ↓ depend on
Layout primitives (cjm-fasthtml-app-core: page chrome, column+queue, toolbar)
    ↓ depend on
Design-system recipes (THIS LIBRARY: panels, chrome, insets, ...)
    ↓ depend on
Styling primitives (cjm-fasthtml-daisyui, cjm-fasthtml-tailwind: tokens)

Consumers import named roles (panels.dashboard_tile, chrome.column_header) instead of reaching for styling tokens directly. This makes coordinated styling changes a single-file edit in this library rather than N-file edits across every consumer, and keeps the role API stable across a potential future FastHTML-to-native port.

Design System Document

The authoritative specification of principles (P1–P12), conventions (V1–V10…), interaction archetypes, layout primitives, component primitives, gap catalog, and priority tasks lives in the living-reference Markdown document at:

claude-docs/design-system/multi-workflow-design-system.md

(hosted in the decomposition workflow repo — the doc governs UI/UX decisions across the entire multi-workflow pipeline and predates this code-side codification.)

This library is the running-code companion to that document. Each codified convention maps to a notebook in nbs/:

Convention Notebook Module What it codifies
V10 Panel variants nbs/panels.ipynb cjm_fasthtml_design_system.panels P1–P4 full-panel recipes
V10 Chrome variants nbs/chrome.ipynb cjm_fasthtml_design_system.chrome C1–C2 column header/footer recipes
V10 Inset variants nbs/insets.ipynb cjm_fasthtml_design_system.insets I1 opacity-modulated inset recipes

Future codifications (icon-size roles, button roles, destructive-confirm composition, text-role tiers) will land as additional notebooks following the same convention-to-notebook mapping.

Usage

Every recipe module exports a module-level instance of a frozen dataclass. Consumers import the instance and use attribute access:

from fasthtml.common import Div

from cjm_fasthtml_design_system.panels import panels
from cjm_fasthtml_design_system.chrome import chrome
from cjm_fasthtml_design_system.insets import insets

from cjm_fasthtml_tailwind.core.base import combine_classes
from cjm_fasthtml_tailwind.utilities.sizing import w
from cjm_fasthtml_tailwind.utilities.spacing import m

# Stand-alone use
Div(..., cls=panels.structural_container)

# Composable with site-specific modifiers
Div(..., cls=combine_classes(w.full, m.t(4), panels.content_panel))

# Chrome sits inside a panel
Div(
    Div('Header', cls=chrome.column_header),
    Div('Body'),
    Div('Status', cls=chrome.column_footer),
    cls=panels.structural_container,
)

Why frozen dataclass: renaming a field is a breaking change announced in the type, which enforces namespace-as-public-contract discipline. Consumers can’t accidentally mutate roles at runtime. A native-platform port replaces the instantiation while keeping the class shape stable; consumer imports never move.

Why per-category modules: panels, chrome, and insets will evolve at different cadences. Keeping them separate means a change to one category doesn’t force re-export of the others.

Extending the Library

When a new convention emerges in the design-system document (e.g., G6 icon-size roles, V1 button-role codification, G8 destructive-confirm composition), add a new notebook under nbs/ following the V10 pattern:

  1. Create nbs/<category>.ipynb with #| default_exp <category>.
  2. Define a frozen XVariants dataclass enumerating the roles.
  3. Instantiate it at module scope as a singleton (e.g., x_variants = XVariants(...)).
  4. Add attribute-level tests asserting each role contains its expected primitives.
  5. Update this index’s convention-to-notebook table.

The recipe layer’s public contract is the set of dataclass class names and field names. Internal composition (which primitives each recipe combines) can evolve without breaking consumers as long as the field names stay stable.

Project Structure

nbs/
├── chrome.ipynb # Named chrome-role recipes for header and footer bands that accompany a content panel. Chrome uses directional borders (top or bottom) and intrinsic padding to signal its role as a structural band, with `border_radius.box` so it reads as a self-contained surface whether placed as a page-level sibling of a panel or nested inside one.
├── insets.ipynb # Named inset-role recipes for opacity-modulated low-emphasis regions *inside* a panel. Insets never stand alone — they're sub-regions that need visual grouping without adding a second panel border.
└── panels.ipynb # Named panel-role recipes for full content containers with `border_radius.box`. Each role composes a specific set of DaisyUI and Tailwind primitives and exposes a stable attribute-access API for consumers.

Total: 3 notebooks

Module Dependencies

graph LR
    chrome[chrome<br/>Chrome Variants]
    insets[insets<br/>Inset Variants]
    panels[panels<br/>Panel Variants]

No cross-module dependencies detected.

CLI Reference

No CLI commands found in this project.

Module Overview

Detailed documentation for each module in the project:

Chrome Variants (V10) (chrome.ipynb)

Named chrome-role recipes for header and footer bands that accompany a content panel. Chrome uses directional borders (top or bottom) and intrinsic padding to signal its role as a structural band, with border_radius.box so it reads as a self-contained surface whether placed as a page-level sibling of a panel or nested inside one.

Import

from cjm_fasthtml_design_system.chrome import (
    chrome,
    ChromeVariants
)

Classes

class ChromeVariants:
    "Named chrome-role recipes (V10). Header/footer bands with directional borders, rounded corners."

Inset Variants (V10) (insets.ipynb)

Named inset-role recipes for opacity-modulated low-emphasis regions inside a panel. Insets never stand alone — they’re sub-regions that need visual grouping without adding a second panel border.

Import

from cjm_fasthtml_design_system.insets import (
    insets,
    InsetVariants
)

Classes

class InsetVariants:
    "Named inset-role recipes (V10). Opacity-modulated low-emphasis regions inside a panel."

Panel Variants (V10) (panels.ipynb)

Named panel-role recipes for full content containers with border_radius.box. Each role composes a specific set of DaisyUI and Tailwind primitives and exposes a stable attribute-access API for consumers.

Import

from cjm_fasthtml_design_system.panels import (
    panels,
    PanelVariants
)

Classes

class PanelVariants:
    "Named panel-role recipes (V10). Each field is a pre-composed CSS class string."

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

cjm_fasthtml_design_system-0.0.3.tar.gz (10.2 kB view details)

Uploaded Source

Built Distribution

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

cjm_fasthtml_design_system-0.0.3-py3-none-any.whl (12.0 kB view details)

Uploaded Python 3

File details

Details for the file cjm_fasthtml_design_system-0.0.3.tar.gz.

File metadata

File hashes

Hashes for cjm_fasthtml_design_system-0.0.3.tar.gz
Algorithm Hash digest
SHA256 397afe74069442dd07d3b2e9d48c9ee56721d877d692ccf2849749b71bbcb804
MD5 ef3825b91bbf9ed4cd7e276fcd74dd5d
BLAKE2b-256 6d27e9acc83e5950fc6387aeff5449c6dc4402ca3207b8635f99dd31645b1ff7

See more details on using hashes here.

File details

Details for the file cjm_fasthtml_design_system-0.0.3-py3-none-any.whl.

File metadata

File hashes

Hashes for cjm_fasthtml_design_system-0.0.3-py3-none-any.whl
Algorithm Hash digest
SHA256 4b1b7e11d12366f8e9948fbdb927c3f0d0d6099d9908cf623892961ca7579e61
MD5 ed257104d4e5deecb8fcd01d5f3c956c
BLAKE2b-256 027b22eedadb44eef9352fdabd3512a47a8af7d693932e065906a98bf8f12cef

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