Prototype archive: Components that carry their design¶
An experimental Python authoring model for importing a component together with its appearance, customizing it without knowing its internal selectors, and describing a table column once.
Archived design prototype
See the current component guide and release status for the current alpha.
This page shows the draft at source commit
f88cced.
fullbleed.ui.experimental is not included in the published 2.5.26 wheel on PyPI.
Names and behavior may change. Use the released component guide
for the stable authoring API.
The newer component alpha builds on this design with cards, data tables, form helpers, the 23 Bootstrap 5.0.0 component families, and styled or unstyled HTML export. Install it by explicit PyPI version. The examples and pinned download on this page retain the original preview for reproducibility.
Download the example kit Read the implementation review Review the draft
One kit, two documents¶
The invoice and operations report import the same Field, WorkTable, Total
and typography helpers. Their shared kit
owns those styles; neither document registers a separate stylesheet. All data
and organizations are fictional.
Invoice · One A4 page
One document combines a customer field, a table with formatted columns and a total panel. Its blue brand values come from the document theme.
Operations report · Five Letter pages
The report changes the theme and supplies 60 records to the same table. Column headers repeat as the rows flow over five pages. The total panel reuses the invoice component with a root override and an advertised label-part override.
These images were rendered from the downloadable PDFs with PDFium. The artifact manifest records the source revision, candidate wheel, file hashes, page counts and verification scope.
Make your first PDF¶
After installing the preview, save this as
first_pdf.py and run python first_pdf.py. It writes summary.pdf using an
explicitly selected bundled font. The example kit includes this exact program.
Themes and named parts are optional; this example needs neither:
from importlib.resources import files
from pathlib import Path
from fullbleed.ui.experimental import (
Document, Flow, Heading, Page, Paragraph, Renderer, Stack, component, mm, pt,
)
@component
def Field(label: str, value: str):
return Stack(
Paragraph(label).with_style(font_size=pt(8), color="#667580"),
Paragraph(value),
gap=pt(4),
)
body = Flow(
Heading("Project summary", level=1),
Field("Prepared for", "Maple & Finch"),
Field("Status", "Ready for review"),
gap=pt(14),
).with_style(font_family="Inter", font_size=pt(11), color="#263b46")
document = Document(body, title="Project summary", page=Page("A5", margin=mm(16)))
font = files("fullbleed_assets").joinpath("fonts/Inter-Variable.ttf")
renderer = Renderer(font_files=[str(font)])
Path("summary.pdf").write_bytes(document.render_pdf(renderer))
Importing Field carries the label's appearance into another document. Ordinary
functions compose nodes; @component adds a name and source boundary for
diagnostics. Change the label color inside Field to update both fields, or
customize one returned instance:
customer = Field("Prepared for", "Maple & Finch")
highlighted = customer.with_style(background="#f2f5f8", padding=pt(12))
The root override returns a new node; customer keeps its original appearance.
The function does not have to accept and forward a style parameter.
For repeated defaults, the draft offers styled(...); for shared brand values,
Theme and tokens; for public internals, declared parts and .with_parts(...).
The runnable guide
introduces each separately.
class_name is a literal CSS class label. It does not look up a Python variable
or load a stylesheet. Components normally carry style values; existing selector
rules can be attached explicitly with Document(styles=...).
Rebrand a theme without rebuilding it¶
A reusable label can refer to a theme value. Deriving a new theme retains its typography and leaves existing documents alone:
from fullbleed.ui.experimental import Theme, style, styled, token
BrandLabel = styled(Paragraph, color=token("accent"), font_size=pt(14))
label = BrandLabel("Portable design")
base_theme = Theme(
{"accent": "#315d9b", "ink": "#263b46"},
text=style(font_family="Inter", color=token("ink")),
)
warm_theme = base_theme.with_values(accent="#9a462e")
assert label.required_tokens == ("accent",)
required_tokens reports the explicit theme references in the constructed node.
The document's version includes its text and selector styles too. It helps a kit consumer see
what to supply without reading selectors or discovering missing values one error
at a time. It describes the current content, not every possible component variant.
A column owns its header and cells¶
from fullbleed.ui.experimental import Column, DataTable, mm
table = DataTable(
[{"name": "Design", "amount": "$120.00"}],
columns=[
Column("Work", lambda row: row["name"]),
Column("Amount", lambda row: row["amount"], align="right", width=mm(30)),
],
empty="No billable items.",
)
Adding a column changes one declaration containing its label, cell function,
alignment and width. Cells can return components. Applications still calculate
and format their values. DataTable supplies the table structure, empty state
and repeated column headers. Ordinary selector rules can change the table's
built-in appearance; explicitly chosen column widths and alignment retain inline
precedence.
Connect an existing class to its styles¶
Use class_name for the label and styles for the rules. A mapping can use the
same style values and theme tokens as a component:
class_notice = Paragraph("Shared selector styling", class_name="notice")
selector_rules = {".notice": style(color=token("accent"), font_weight=700)}
The rendering example below attaches those rules. styles also accepts CSS text
and the existing StyleSheet class; inputs are captured when constructing the
document. Normal class rules can override reusable defaults. An explicit instance
override such as .with_style(color="#245541") has inline precedence; an external
!important declaration can still override a normal inline declaration. Class
order in class_name does not set priority. The native engine resolves CSS.
Paper size, orientation and page margins belong to Page; competing @page
geometry in styles raises an error. Page furniture remains available through
CSS. The runnable guide describes this ownership rule and advanced limitations.
Render the composed document¶
The first Python block runs alone. The six blocks also run together to produce this composed example. Paper belongs to the document; font selection belongs to the renderer, which can be shared by your application:
from importlib.resources import files
from pathlib import Path
from fullbleed.ui.experimental import Flow, Page, Renderer
document = Document(
Flow(label, highlighted, class_notice, table, gap=pt(18)),
title="Component design preview",
page=Page("A5", margin=mm(14)),
theme=warm_theme,
styles=selector_rules,
)
renderer = Renderer(
font_files=[str(files("fullbleed_assets").joinpath("fonts/Inter-Variable.ttf"))],
document_timestamp="2026-10-15T00:00:00Z",
)
prepared = document.prepare(renderer)
Path("component-preview.pdf").write_bytes(prepared.render_pdf())
preview_pages = prepared.render_image_pages(dpi=96)
prepare creates one native layout, checks its pagination trace and returns a
snapshot you can reuse for PDF output and layout previews. If you only need the
PDF, document.render_pdf(renderer) handles preparation for you. Content or
renderer changes require a new preparation. The fonts used here ship with the
engine; system fonts and a browser are not required for rendering.
Try the preview¶
Download and extract the example kit,
then open a terminal in its fullbleed-component-preview folder. You need
CPython 3.10 or later and internet access. The installer selects a matching
prebuilt wheel for supported Windows, macOS and Linux platforms. Rust and native
build tools are not needed for that installation.
The kit contains Python examples and a pinned installer; the engine is downloaded from the GitHub preview. The download manifest records the kit's files and the exact wheel URLs and hashes. Use an isolated environment:
Install the preview and render the examples:
python -m pip install --force-reinstall -r requirements-preview.txt
python first_pdf.py
python examples/component_recipes/main.py --output output
python edit_tasks.py --output output/edits
Open summary.pdf first, then output/invoice.pdf and output/report.pdf.
Edit examples/component_recipes/kit.py to change shared components, or
documents.py to change a document's composition. No browser is used to produce
the PDFs.
This snapshot retains package version 2.5.26, but differs from PyPI's 2.5.26.
The installer uses only the preview's exact wheel files and checks their hashes;
--force-reinstall replaces an existing package with the same version in this
isolated environment. The source commit and hashes identify the experiment.
Build from source
If no listed wheel matches your platform, or you want to work on the engine,
the kit also includes requirements-source.txt. This path requires
Rust/Cargo and your platform's native build tools:
It builds the same pinned source commit and may take several minutes.
The kit's edit_tasks.py gives you five small starting points:
| Editing task | Function |
|---|---|
| Reuse components and change the brand | shared_components() |
| Add a formatted column | extra_column() |
| Change the invoice's paper size | paper_change() |
| Apply shared class styles and override one instance | selector_styles() |
| Find and repair a clipping constraint | layout_repair() |
The last task intentionally catches a layout error and saves its authored path
and reason in output/edits/expected-layout-error.json, then renders the repair.
What needs review¶
The draft has rendered-output checks, but independent usability feedback is still needed. Try an ordinary editing task: reuse a field in another document, change the brand, add a table column, change the paper size, or diagnose content that does not fit. Report where you needed an internal selector, generated HTML or an undocumented behavior. A small input and the expected layout are useful.
The current limits matter when evaluating the design:
- Oversized top-aligned text cells can continue, but rowspans, page-tall cell images and oversized cells with other vertical alignments need further work.
- Native table and block split errors identify the responsible cell or container when the engine provides that cause. Other failures retain their authored scope; this is not a general overflow validator.
- Token requirements and advertised part names are discoverable at runtime; automatic completion of those names in editors is unfinished.
- Shared preparation avoids repeating layout for PDF and preview output. Large-scale performance and engine pooling still need qualification.
- Explicit semantic validation now reuses the established accessibility contract and adds component locations. Final delivery-profile verification remains separate; these examples do not establish accessibility conformance.
Existing documents can try one new component through the explicit to_legacy
adapter described in the runnable guide. This does not deprecate the established
API or promise equivalent experimental interfaces in other languages.

