Skip to main content

SwiftUI inspired wrapper for FastHTML

Project description

fhswiftui

fhswiftui is a SwiftUI inspired wrapper for FastHTML and tailwind. fhswiftui is built on top of FastHTML and tailwind and will work with all FT components. Tailwind classes and FastHTML features work seamlessly.

FastHTML enables composing HTML apps by nested Python objects and tailwind is a CSS framework that provides standard CSS components. Since tailwind relies heavily on CSS classes to define components as well as include style information, this can quickly become complex and difficult to read.

For example, let’s consider a simple example of a turn in a chat which displays a user’s message with a timestamp. In FastHTML + tailwind, this would look like something:

Section(
    Div(
        Span('04:30:56', cls='text-xs text-muted-foreground'),
        Div('What is the meaning of life?', cls='flex w-max max-w-[75%] flex-col gap-2 rounded-lg px-3 py-2 text-sm border-l-4 border-primary italic'),
        cls='flex gap-2 items-center'
    ),
    cls='space-y-6'
)

fhswiftui provides layout and UI components. It also provides property setters that enable specific styling. The same example above using fhswiftui:

HStack(alignment="center")(
    Text('04:30:56').fg("muted-foreground").font(size="xs"),
    VDivider(border_color),
    Div(t.m).padding(left=3, right=3, top=2, bottom=2).font(size="sm")
)

fhswiftui is built on top of FastHTML and tailwind and will work with all FT components. Tailwind classes and FastHTML features work seamlessly.

Installation

Install latest from pypi

$ pip install fhswiftui

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

fhswiftui-0.0.1.tar.gz (11.7 kB view details)

Uploaded Source

Built Distribution

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

fhswiftui-0.0.1-py3-none-any.whl (10.9 kB view details)

Uploaded Python 3

File details

Details for the file fhswiftui-0.0.1.tar.gz.

File metadata

  • Download URL: fhswiftui-0.0.1.tar.gz
  • Upload date:
  • Size: 11.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.12.12

File hashes

Hashes for fhswiftui-0.0.1.tar.gz
Algorithm Hash digest
SHA256 46b3b631ab745f3a5c90498a6a15e0d92e6c1c0ee514edde808170f68989aa66
MD5 52e6809c302910fe9bde976dc7227cc3
BLAKE2b-256 dfb7915b8bd0fd7ffe772108f809e7b559755afaf2cce232964808ac0a28f6b3

See more details on using hashes here.

File details

Details for the file fhswiftui-0.0.1-py3-none-any.whl.

File metadata

  • Download URL: fhswiftui-0.0.1-py3-none-any.whl
  • Upload date:
  • Size: 10.9 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.12.12

File hashes

Hashes for fhswiftui-0.0.1-py3-none-any.whl
Algorithm Hash digest
SHA256 bab23771bcf8b4481b614f409db9179a821e9038e3228c0ad5c2260c33eb94e8
MD5 944ab8e897f1edddb5fead25a09ff737
BLAKE2b-256 3d355e79ee42d3b4c0e7d00f9b5471bab3af68bd452e2bd9ec21c2ae8d9e02f9

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