text stringlengths 27 54.3k | url stringlengths 31 137 | page_name stringlengths 7 59 |
|---|---|---|
# MonsterUI Documentation
> MonsterUI is a python library which brings styling to python for FastHTML apps.
## API Reference
- [API List](https://raw.githubusercontent.com/AnswerDotAI/MonsterUI/refs/heads/main/docs/apilist.txt): Complete API Reference
## Examples
- [Ticket](https://monsterui.answer.ai/ticket/md): Mo... | https://monsterui.answer.ai/llms.txt | monsterui.answer.ai_llms.txt |
# monsterui Module Documentation
## monsterui.core
- `class Theme(Enum)`
Selector to choose theme and get all headers needed for app. Includes frankenui + tailwind + daisyui + highlight.js options
Members: slate, stone, gray, neutral, red, rose, orange, green, blue, yellow, violet, zinc
- `headers(self,... | https://raw.githubusercontent.com/AnswerDotAI/MonsterUI/refs/heads/main/docs/apilist.txt | docs_apilist.txt |
"""MonsterUI Help Desk Example - Professional Dashboard with DaisyUI components"""
from fasthtml.common import *
from monsterui.all import *
from datetime import datetime
app, rt = fast_app(hdrs=Theme.blue.headers(daisy=True))
def TicketSteps(step):
return Steps(
LiStep("Submitted", data_content="📝",
... | https://monsterui.answer.ai/ticket/md | ticket_md |
"MonsterUI Scrollspy Example application"
from fasthtml.common import *
from monsterui.all import *
import random
# Using the "slate" theme with Highlight.js enabled
hdrs = Theme.slate.headers(highlightjs=True)
app, rt = fast_app(hdrs=hdrs)
################################
### Example Data and Content ###
#########... | https://monsterui.answer.ai/scrollspy/md | scrollspy_md |
"""FrankenUI Dashboard Example built with MonsterUI (original design by ShadCN)"""
from fasthtml.common import * # Bring in all of fasthtml
import fasthtml.common as fh # Used to get unstyled components
from monsterui.all import * # Bring in all of monsterui, including shadowing fasthtml components with styled compone... | https://monsterui.answer.ai/dashboard/md | dashboard_md |
"""FrankenUI Mail Example built with MonsterUI (original design by ShadCN)"""
from fasthtml.common import *
from monsterui.all import *
from fasthtml.svg import *
import pathlib, json
from datetime import datetime
app, rt = fast_app(hdrs=Theme.blue.headers())
sidebar_group1 = (('home', 'Inbox', '128'), ('file-text',... | https://monsterui.answer.ai/mail/md | mail_md |
"""FrankenUI Cards Example built with MonsterUI (original design by ShadCN)"""
from fasthtml.common import *
from fasthtml.components import Uk_input_tag
from fasthtml.svg import *
from monsterui.all import *
import calendar
from datetime import datetime
app, rt = fast_app(hdrs=Theme.blue.headers())
CreateAccount = ... | https://monsterui.answer.ai/cards/md | cards_md |
"""FrankenUI Playground Example built with MonsterUI (original design by ShadCN)"""
from fasthtml.common import *
from monsterui.all import *
from fasthtml.svg import *
app, rt = fast_app(hdrs=Theme.blue.headers())
preset_options = ["Grammatical Standard English", "Summarize for a 2nd grader",
"Text to comma... | https://monsterui.answer.ai/playground/md | playground_md |
"""FrankenUI Tasks Example built with MonsterUI (original design by ShadCN)"""
from fasthtml.common import *
from monsterui.all import *
from fasthtml.svg import *
import json
app, rt = fast_app(hdrs=Theme.blue.headers())
def LAlignedCheckTxt(txt): return DivLAligned(UkIcon(icon='check'), P(txt, cls=TextPresets.mute... | https://monsterui.answer.ai/tasks/md | tasks_md |
"""FrankenUI Music Example build with MonsterUI (Original design by ShadCN)"""
from fasthtml.common import *
from monsterui.all import *
app, rt = fast_app(hdrs=Theme.blue.headers())
def MusicLi(t,hk=''): return Li(A(DivFullySpaced(t,P(hk,cls=TextPresets.muted_sm))))
music_items = [("About Music", "" ),
... | https://monsterui.answer.ai/music/md | music_md |
"""FrankenUI Forms Example built with MonsterUI (original design by ShadCN)"""
from fasthtml.common import *
from monsterui.all import *
from fasthtml.svg import *
app, rt = fast_app(hdrs=Theme.blue.headers())
def HelpText(c): return P(c,cls=TextPresets.muted_sm)
def heading():
return Div(cls="space-y-5")(
... | https://monsterui.answer.ai/forms/md | forms_md |
"""FrankenUI Auth Example built with MonsterUI (original design by ShadCN)"""
from fasthtml.common import *
from monsterui.all import *
from fasthtml.svg import *
app, rt = fast_app(hdrs=Theme.blue.headers())
@rt
def index():
left = Div(cls="col-span-1 hidden flex-col justify-between bg-zinc-900 p-8 text-whi... | https://monsterui.answer.ai/auth/md | auth_md |
# Buttons & Links API Reference
See Source
See Output
DefaultPrimarySecondaryDangerTextLinkGhost
[code]
def ex_buttons():
return Grid(
Button("Default"),
Button("Primary", cls=ButtonT.primary),
Button("Secondary", cls=ButtonT.secondary),
Button("Danger... | https://monsterui.answer.ai/api_ref/docs_button_link/md | docs_button_link_md |
# Cards API Reference
### Example Usage
See Source
See Output
Header
A card with header and footer
Input
Range
Footer Submit Button
[code]
def ex_card():
return Card(
Form(LabelInput("Input"),
LabelRange("Range")),
header=Div(
CardTitle("Hea... | https://monsterui.answer.ai/api_ref/docs_cards/md | docs_cards_md |
# Articles, Containers & Sections API Reference
### ArticleMeta
Source
[code]
ArticleMeta(*c, cls=(), **kwargs) -> fastcore.xml.FT
[/code]
> A metadata component for use within an Article showing things like date, author etc
**Params**
* `c` contents of ArticleMeta tag (often other tags)
* `cls` Classes... | https://monsterui.answer.ai/api_ref/docs_containers/md | docs_containers_md |
# Dividers API Reference
### Divider
Source
[code]
Divider(*c, cls=('my-4', <DividerT.icon: 'uk-divider-icon'>), **kwargs) -> fastcore.xml.FT
[/code]
> Divider with default styling and margin
**Params**
* `c` contents of Divider tag (often nothing)
* `cls` Classes in addition to Divider styling
* `kw... | https://monsterui.answer.ai/api_ref/docs_dividers/md | docs_dividers_md |
# Forms and User Inputs API Reference
### Example Form
This form was live coded in a 5 minute video here
See Source
See Output
### Emergency Contact Form
Please fill out the form completely
First Name
Last Name
Email
Phone
### Relationship to patient
Parent
Sibling
Friend
Spouse
Significant Other
Relat... | https://monsterui.answer.ai/api_ref/docs_forms/md | docs_forms_md |
# Icons & Images API Reference
# Avatars
See Source
See Output
[code]
def ex_dicebear():
return DivLAligned(
DiceBearAvatar('Isaac Flath',10,10),
DiceBearAvatar('Aaliyah',10,10),
DiceBearAvatar('Alyssa',10,10))
[/code]
### DiceBearAvatar
Source
[code]
Di... | https://monsterui.answer.ai/api_ref/docs_icons_images/md | docs_icons_images_md |
# Layout (Flex and Grid) API Reference
This page covers `Grid`s, which are often used for general structure, `Flex` which is often used for layout of components that are not grid based, padding and positioning that can help you make your layout look good, and dividers that can help break up the page
## Grid
See Sour... | https://monsterui.answer.ai/api_ref/docs_layout/md | docs_layout_md |
# Lists API Reference
See Source
See Output
#### disc List:
* Item 1
* Item 2
#### circle List:
* Item 1
* Item 2
#### square List:
* Item 1
* Item 2
#### decimal List:
* Item 1
* Item 2
#### hyphen List:
* Item 1
* Item 2
#### bullet List:
* Item 1
* Item 2
#### divider List:
... | https://monsterui.answer.ai/api_ref/docs_lists/md | docs_lists_md |
# Loading IndicatorsAPI Reference
See Source
See Output
[code]
def ex_loading1():
return Loading()
[/code]
See Source
See Output
[code]
def ex_loading2():
types = [LoadingT.spinner, LoadingT.dots, LoadingT.ring, LoadingT.ball, LoadingT.bars, LoadingT.infinity]
sizes = [Loadi... | https://monsterui.answer.ai/api_ref/docs_loading/md | docs_loading_md |
# Markdown + automated HTML styling API Reference
See Source
See Output
# Example Markdown
* With **bold** and _italics_
* With a link
### And a subheading
> This is a blockquote
This supports inline latex: $e^{\pi i} + 1 = 0$ as well as block latex thanks to Katex.
$$ \frac{1}{2\pi i} \oint_C \frac{f(z)}{z... | https://monsterui.answer.ai/api_ref/docs_markdown_HTMLstyling/md | docs_markdown_HTMLstyling_md |
# Modals API Reference
### Example Modal
This is a subtitle
See Source
See Output
Open Modal
## Simple Test Modal
With some somewhat brief content to show that it works!
Close
[code]
def ex_modal():
return Div(
Button("Open Modal",data_uk_toggle="target: #my-modal" ),
Modal... | https://monsterui.answer.ai/api_ref/docs_modals/md | docs_modals_md |
# Navigation (Nav, NavBar, Tabs, etc.) API Reference
# Nav, NavBar, DowDownNav, and Tab examples
* * *
## Nav
See Source
See Output
* Option 1
* Option 2
* Option 3
[code]
def ex_nav1():
mbrs1 = [Li(A('Option 1'), cls='uk-active'), Li(A('Option 2')), Li(A('Option 3'))]
return NavContai... | https://monsterui.answer.ai/api_ref/docs_navigation/md | docs_navigation_md |
# Alerts & Toasts API Reference
### Alerts
The simplest alert is a div wrapped with a span:
See Source
See Output
This is a plain alert
[code]
def ex_alerts1(): return Alert("This is a plain alert")
[/code]
Alert colors are defined by the alert styles:
See Source
See Output
Your purchase has been co... | https://monsterui.answer.ai/api_ref/docs_notifications/md | docs_notifications_md |
# Carousel Sliders API Reference
Here is a simple example of a slider:
See Source
See Output
[code]
def ex_sliders_1():
return Slider(*[Img(src=f'https://picsum.photos/200/200?random={i}') for i in range(10)])
[/code]
Here is a slider with cards:
See Source
See Output
### Card 0
Card 0 conten... | https://monsterui.answer.ai/api_ref/docs_sliders/md | docs_sliders_md |
# Steps API Reference
See Source
See Output
* Account Created
* Profile Setup
* Verification
[code]
def ex_steps2():
return Steps(
LiStep("Account Created", cls=StepT.primary),
LiStep("Profile Setup", cls=StepT.neutral),
LiStep("Verification", cls=StepT.neutral... | https://monsterui.answer.ai/api_ref/docs_steps/md | docs_steps_md |
# Tables API Reference
See Source
See Output
Name | Age | City
---|---|---
Alice | 25 | New York
Bob | 30 | San Francisco
Charlie | 35 | London
Total | 90
[code]
def ex_tables0():
return Table(
Thead(Tr(Th('Name'), Th('Age'), Th('City'))),
Tbody(Tr(Td('Alice'), Td(... | https://monsterui.answer.ai/api_ref/docs_tables/md | docs_tables_md |
# Theme and Headers API Reference
To get headers with a default theme use `hdrs=Theme.<color>.headers()`. For example for the blue theme you would use `hdrs=Theme.blue.headers()`. The theme integrated together different frameworks and allows tailwind, FrankenUI, HighlighJS, and DaisyUI components to work well together... | https://monsterui.answer.ai/api_ref/docs_theme_headers/md | docs_theme_headers_md |
# Typography API Reference
Ready to go semantic options that cover most of what you need based on the HTML spec
See Source
See Output
Titled
# Titled
# Level 1 Heading (H1)
## Level 2 Heading (H2)
### Level 3 Heading (H3)
#### Level 4 Heading (H4)
##### Level 5 Heading (H5)
###### Level 6 Heading (H6)
[code... | https://monsterui.answer.ai/api_ref/docs_typography/md | docs_typography_md |
# MonterUI Page Layout Guide
This guide will discuss 3 tools for laying out your app pages, Grid, Flexbox, and Columns. This page will discuss the strengths and when to use each individually, and then a section for how to combine them for more complex layouts at the end.
> Note: This guide is designed to get you star... | https://monsterui.answer.ai/tutorial_layout/md | tutorial_layout_md |
# Padding & Margin & Spacing, Oh my! (MonsterUI Spacing Guide)
This guide will cover some essentials about how to properly space apps and what the differences are between:
* Padding
* Margin
* Spacing
* Gap
Manipulating the space between components can make a huge difference to the percieved quality of the p... | https://monsterui.answer.ai/tutorial_spacing/md | tutorial_spacing_md |
# FastHTML
> FastHTML is a python library which brings together Starlette, Uvicorn, HTMX, and fastcore's `FT` "FastTags" into a library for creating server-rendered hypermedia applications. The `FastHTML` class itself inherits from `Starlette`, and adds decorator-based routing with many additions, Beforeware, automati... | https://docs.fastht.ml/llms.txt | docs.fastht.ml_llms.txt |
# Web Devs Quickstart
<!-- WARNING: THIS FILE WAS AUTOGENERATED! DO NOT EDIT! -->
## Installation
``` bash
pip install python-fasthtml
```
## A Minimal Application
A minimal FastHTML application looks something like this:
<div class="code-with-filename">
**main.py**
``` python
from fasthtml.common import *
ap... | https://docs.fastht.ml/tutorials/quickstart_for_web_devs.html.md | tutorials_quickstart_for_web_devs.html.md |
+++
title = "Reference"
+++
## Contents
* [htmx Core Attributes](#attributes)
* [htmx Additional Attributes](#attributes-additional)
* [htmx CSS Classes](#classes)
* [htmx Request Headers](#request_headers)
* [htmx Response Headers](#response_headers)
* [htmx Events](#events)
* [htmx Extensions](/extensions)
* [JavaS... | https://raw.githubusercontent.com/bigskysoftware/htmx/master/www/content/reference.md | content_reference.md |
# 🗿 Surreal
### Tiny jQuery alternative for plain Javascript with inline [Locality of Behavior](https://htmx.org/essays/locality-of-behaviour/)!

(Art by [shahabalizadeh](https://www.deviantart.com/shahabalizad... | https://raw.githubusercontent.com/AnswerDotAI/surreal/main/README.md | main_README.md |
# 🌘 CSS Scope Inline

(Art by [shahabalizadeh](https://www.artstation.com/artwork/zDgdd))
## Why does this exist?
* You want an easy inline vanilla CSS experience without Tailwind CSS.
* Hate creating unique class na... | https://raw.githubusercontent.com/gnat/css-scope-inline/main/README.md | main_README.md |
# 🌟 Starlette Quick Manual
<!-- originally from bofeng.github.io -->
2020-02-09
Starlette is the ASGI web framework used as the foundation of FastHTML. Listed here are some Starlette features FastHTML developers can use directly, since the `FastHTML` class inherits from the `Starlette` class (but note that FastHTML... | https://gist.githubusercontent.com/jph00/e91192e9bdc1640f5421ce3c904f2efb/raw/61a2774912414029edaf1a55b506f0e283b93c46/starlette-quick.md | 61a2774912414029edaf1a55b506f0e283b93c46_starlette-quick.md |
# fasthtml Module Documentation
## fasthtml.authmw
- `class BasicAuthMiddleware`
- `def __init__(self, app, cb, skip)`
- `def __call__(self, scope, receive, send)`
- `def authenticate(self, conn)`
## fasthtml.cli
- `@call_parse def railway_link()`
Link the current directory to the current project's ... | https://docs.fastht.ml/apilist.txt | docs.fastht.ml_apilist.txt |
from asyncio import sleep
from fasthtml.common import *
app = FastHTML(exts='ws')
rt = app.route
def mk_inp(): return Input(id='msg')
nid = 'notifications'
@rt('/')
async def get():
cts = Div(
Div(id=nid),
Form(mk_inp(), id='form', ws_send=True),
hx_ext='ws', ws_connect='/ws')
return ... | https://raw.githubusercontent.com/AnswerDotAI/fasthtml/main/examples/basic_ws.py | examples_basic_ws.py |
###
# Walkthrough of an idiomatic fasthtml app
###
# This fasthtml app includes functionality from fastcore, starlette, fastlite, and fasthtml itself.
# Run with: `python adv_app.py`
# Importing from `fasthtml.common` brings the key parts of all of these together.
# For simplicity, you can just `from fasthtml.common i... | https://raw.githubusercontent.com/AnswerDotAI/fasthtml/main/examples/adv_app.py | examples_adv_app.py |
# index.md
---
# Starlette Introduction
Starlette is a lightweight [ASGI][asgi] framework/toolkit,
which is ideal for building async web services in Python.
It is production-ready, and gives you the following:
* A lightweight, low-complexity HTTP web framework.
* WebSocket support.
* In-process background tasks.
*... | https://gist.githubusercontent.com/jph00/809e4a4808d4510be0e3dc9565e9cbd3/raw/9b717589ca44cedc8aaf00b2b8cacef922964c0f/starlette-sml.md | 9b717589ca44cedc8aaf00b2b8cacef922964c0f_starlette-sml.md |
# JS App Walkthrough
<!-- WARNING: THIS FILE WAS AUTOGENERATED! DO NOT EDIT! -->
## Installation
You’ll need the following software to complete the tutorial, read on for
specific installation instructions:
1. Python
2. A Python package manager such as pip (which normally comes with
Python) or uv
3. FastHTML... | https://docs.fastht.ml/tutorials/e2e.html.md | tutorials_e2e.html.md |
# FastHTML By Example
<!-- WARNING: THIS FILE WAS AUTOGENERATED! DO NOT EDIT! -->
This tutorial provides an alternate introduction to FastHTML by building
out example applications. We also illustrate how to use FastHTML
foundations to create custom web apps. Finally, this document serves as
minimal context for a LLM... | https://docs.fastht.ml/tutorials/by_example.html.md | tutorials_by_example.html.md |
# Using Jupyter to write FastHTML
<!-- WARNING: THIS FILE WAS AUTOGENERATED! DO NOT EDIT! -->
Writing FastHTML applications in Jupyter notebooks requires a slightly
different process than normal Python applications.
<div>
> **Download this notebook and try it yourself**
>
> The source code for this page is a [Jupy... | https://docs.fastht.ml/tutorials/jupyter_and_fasthtml.html.md | tutorials_jupyter_and_fasthtml.html.md |
# **FT** Components
<!-- WARNING: THIS FILE WAS AUTOGENERATED! DO NOT EDIT! -->
**FT**, or ‘FastTags’, are the display components of FastHTML. In fact,
the word “components” in the context of FastHTML is often synonymous
with **FT**.
For example, when we look at a FastHTML app, in particular the views, as
well as v... | https://docs.fastht.ml/explains/explaining_xt_components.html.md | explains_explaining_xt_components.html.md |
# FAQ
<!-- WARNING: THIS FILE WAS AUTOGENERATED! DO NOT EDIT! -->
## Why does my editor say that I have errors in my FastHTML code?
Many editors, including Visual Studio Code, use PyLance to provide error
checking for Python. However, PyLance’s error checking is just a guess –
it can’t actually know whether your co... | https://docs.fastht.ml/explains/faq.html.md | explains_faq.html.md |
# MiniDataAPI Spec
<!-- WARNING: THIS FILE WAS AUTOGENERATED! DO NOT EDIT! -->
The `MiniDataAPI` is a persistence API specification that designed to be
small and relatively easy to implement across a wide range of
datastores. While early implementations have been SQL-based, the
specification can be quickly implement... | https://docs.fastht.ml/explains/minidataapi.html.md | explains_minidataapi.html.md |
# OAuth
<!-- WARNING: THIS FILE WAS AUTOGENERATED! DO NOT EDIT! -->
OAuth is an open standard for ‘access delegation’, commonly used as a
way for Internet users to grant websites or applications access to their
information on other websites but without giving them the passwords. It
is the mechanism that enables “Log... | https://docs.fastht.ml/explains/oauth.html.md | explains_oauth.html.md |
# Routes
<!-- WARNING: THIS FILE WAS AUTOGENERATED! DO NOT EDIT! -->
Behaviour in FastHTML apps is defined by routes. The syntax is largely
the same as the wonderful [FastAPI](https://fastapi.tiangolo.com/)
(which is what you should be using instead of this if you’re creating a
JSON service. FastHTML is mainly for m... | https://docs.fastht.ml/explains/routes.html.md | explains_routes.html.md |
# WebSockets
<!-- WARNING: THIS FILE WAS AUTOGENERATED! DO NOT EDIT! -->
Websockets are a protocol for two-way, persistent communication between
a client and server. This is different from HTTP, which uses a
request/response model where the client sends a request and the server
responds. With websockets, either part... | https://docs.fastht.ml/explains/websockets.html.md | explains_websockets.html.md |
Error: 404 Client Error: Not Found for url: https://docs.fastht.ml/ref/defining_xt_component.html.md | https://docs.fastht.ml/ref/defining_xt_component.html.md | ref_defining_xt_component.html.md |
# Handling handlers
<!-- WARNING: THIS FILE WAS AUTOGENERATED! DO NOT EDIT! -->
``` python
from fasthtml.common import *
from collections import namedtuple
from typing import TypedDict
from datetime import datetime
import json,time
```
``` python
app = FastHTML()
```
The [`FastHTML`](https://docs.fastht.ml/api/cor... | https://docs.fastht.ml/ref/handlers.html.md | ref_handlers.html.md |
# Live Reloading
<!-- WARNING: THIS FILE WAS AUTOGENERATED! DO NOT EDIT! -->
When building your app it can be useful to view your changes in a web
browser as you make them. FastHTML supports live reloading which means
that it watches for any changes to your code and automatically refreshes
the webpage in your browse... | https://docs.fastht.ml/ref/live_reload.html.md | ref_live_reload.html.md |
import plotly.express as px from fasthtml.common import * # Add the Plotly library to the headers app, rt = fast_app(hdrs=(Script(src="https://cdn.plot.ly/plotly-2.24.1.min.js"),)) def create_scatter_plot(): # Create simple scatter plot with 5 points fig = px.scatter( x=[1, 2, 3, 4, 5], y=[2, 4, 1, 3, 5], labels={"x": ... | https://gallery.fastht.ml/split/visualizations/plotly_selections | FastHTML page |
from fasthtml.common import * import numpy as np plot_js = """ function createPlot(data) { const plot = Plot.rectY(data, Plot.binX({y: "count"},{x: d => d.value,fill:"steelblue"})).plot(); const div = document.querySelector("#plot"); div.replaceChildren(plot); } // Set up initial load via HTMX htmx.on('htmx:afterSettle... | https://gallery.fastht.ml/split/visualizations/observable_plot | FastHTML page |
from fasthtml.common import * import pandas as pd import numpy as np import plotly.express as px from fh_plotly import plotly2fasthtml, plotly_headers app, rt = fast_app(hdrs=(plotly_headers,)) y_data = [1, 2, 3, 2] x_data = [3, 1, 2, 4] def generate_line_chart(): df = pd.DataFrame({'y': y_data, 'x': x_data}) fig = px.... | https://gallery.fastht.ml/split/visualizations/plotly_charts | FastHTML page |
from fasthtml.common import * import pandas as pd import numpy as np import plotly.express as px from fh_plotly import plotly2fasthtml, plotly_headers app, rt = fast_app(hdrs=(plotly_headers,)) y_data = [1, 2, 3, 2] x_data = [3, 1, 2, 4] def generate_line_chart(): df = pd.DataFrame({'y': y_data, 'x': x_data}) fig = px.... | https://gallery.fastht.ml/code/visualizations/plotly_charts | FastHTML page |
from fh_matplotlib import matplotlib2fasthtml from fasthtml.common import * import numpy as np import matplotlib.pylab as plt app, rt = fast_app() @matplotlib2fasthtml def generate_chart(num_points): plotdata = [np.random.exponential(1) for _ in range(num_points)] plt.plot(range(len(plotdata)), plotdata) @rt def index(... | https://gallery.fastht.ml/code/visualizations/matplotlib_charts | FastHTML page |
from fasthtml.common import * import numpy as np plot_js = """ function createPlot(data) { const plot = Plot.rectY(data, Plot.binX({y: "count"},{x: d => d.value,fill:"steelblue"})).plot(); const div = document.querySelector("#plot"); div.replaceChildren(plot); } // Set up initial load via HTMX htmx.on('htmx:afterSettle... | https://gallery.fastht.ml/code/visualizations/observable_plot | FastHTML page |
from functools import cache import polars as pl from great_tables import GT, html from great_tables.data import sza from fasthtml.common import * app, rt = fast_app() @cache def get_sza_pivot(): # Filter and pivot the data return (pl.from_pandas(sza) .filter((pl.col("latitude") == "20") & (pl.col("tst") <= "1200")) .se... | https://gallery.fastht.ml/code/visualizations/great_tables_tables | FastHTML page |
from fh_matplotlib import matplotlib2fasthtml from fasthtml.common import * import numpy as np import matplotlib.pylab as plt app, rt = fast_app() @matplotlib2fasthtml def generate_chart(num_points): plotdata = [np.random.exponential(1) for _ in range(num_points)] plt.plot(range(len(plotdata)), plotdata) @rt def index(... | https://gallery.fastht.ml/split/visualizations/matplotlib_charts | FastHTML page |
from functools import cache import polars as pl from great_tables import GT, html from great_tables.data import sza from fasthtml.common import * app, rt = fast_app() @cache def get_sza_pivot(): # Filter and pivot the data return (pl.from_pandas(sza) .filter((pl.col("latitude") == "20") & (pl.col("tst") <= "1200")) .se... | https://gallery.fastht.ml/split/visualizations/great_tables_tables | FastHTML page |
Tic Tac Toe Web App
This project is a web-based implementation of the classic Tic Tac Toe game built by Adedara Adeloro using FastHTML, HTMX, and Tailwind CSS.
The build steps from the original project were simplifed to use CDNs for the FastHTML Gallery version. To check out the original project, click here
Key Tech... | https://gallery.fastht.ml/info/applications/tic_tac_toe | FastHTML page |
import numpy as np from fasthtml.common import * import plotly.graph_objects as go from fh_plotly import plotly2fasthtml, plotly_headers ######################## ### FastHTML Section ### ######################## app, rt = fast_app(hdrs=(plotly_headers,)) @rt def index(): desc = """ The Bloch Sphere is a 3D visualizatio... | https://gallery.fastht.ml/code/visualizations/bloch_sphere | FastHTML page |
import numpy as np from fasthtml.common import * import plotly.graph_objects as go from fh_plotly import plotly2fasthtml, plotly_headers ######################## ### FastHTML Section ### ######################## app, rt = fast_app(hdrs=(plotly_headers,)) @rt def index(): desc = """ The Bloch Sphere is a 3D visualizatio... | https://gallery.fastht.ml/split/visualizations/bloch_sphere | FastHTML page |
from fasthtml.common import * style = Style("""body{ min-height: 100vh; margin:0; background-color: #1A1A1E; display:grid; }""") # custom style to be applied globally. hdrs = (Script(src="https://cdn.tailwindcss.com") , Link(rel="stylesheet", href="/files/examples/applications/tic_tac_toe/output.css")) app, rt = fast_a... | https://gallery.fastht.ml/code/applications/tic_tac_toe | FastHTML page |
from fasthtml.common import * style = Style("""body{ min-height: 100vh; margin:0; background-color: #1A1A1E; display:grid; }""") # custom style to be applied globally. hdrs = (Script(src="https://cdn.tailwindcss.com") , Link(rel="stylesheet", href="/files/examples/applications/tic_tac_toe/output.css")) app, rt = fast_a... | https://gallery.fastht.ml/split/applications/tic_tac_toe | FastHTML page |
from fasthtml.common import * from uuid import uuid4 db = database('sqlite.db') hdrs = (Style(''' button,input { margin: 0 1rem; } [role="group"] { border: 1px solid #ccc; } .edited { outline: 2px solid orange; } '''), ) app, rt = fast_app(hdrs=hdrs) @rt async def get_test_file(): import httpx url = "https://raw.github... | https://gallery.fastht.ml/code/applications/csv_editor | FastHTML page |
CSV Editor App
This project is a web-based CSV editor built using FastHTML, HTMX, and SQLite.
Key Technologies and Techniques
FastHTML: A Python-based framework for building web applications with a focus on web fundamentals.
HTMX: Used to create dynamic server-side content updates that let you interact with the app... | https://gallery.fastht.ml/info/applications/csv_editor | FastHTML page |
from fasthtml.common import * from uuid import uuid4 db = database('sqlite.db') hdrs = (Style(''' button,input { margin: 0 1rem; } [role="group"] { border: 1px solid #ccc; } .edited { outline: 2px solid orange; } '''), ) app, rt = fast_app(hdrs=hdrs) @rt async def get_test_file(): import httpx url = "https://raw.github... | https://gallery.fastht.ml/split/applications/csv_editor | FastHTML page |
from fasthtml.common import * from starlette.responses import Response from uuid import uuid4 generator = {} bindict = { (1,1,1):0, (1,1,0):1, (1,0,1):2, (1,0,0):3, (0,1,1):4, (0,1,0):5, (0,0,1):6, (0,0,0):7} initial_row = [0]*50 + [1] + [0]*50 color_map = {0:"white", 1:"black"} #################### ### HTML Widgets ##... | https://gallery.fastht.ml/code/applications/cellular_automata | FastHTML page |
Cellular Automata
Cellular automata are a class of models used to simulate complex systems. They are used in a wide range of applications, including modeling the spread of diseases, traffic flow, and crowd behavior. This project is a one-dimensional cellular automata.
Cellular Automata Details
We start with an initi... | https://gallery.fastht.ml/info/applications/cellular_automata | FastHTML page |
from fasthtml.common import * from starlette.responses import Response from uuid import uuid4 generator = {} bindict = { (1,1,1):0, (1,1,0):1, (1,0,1):2, (1,0,0):3, (0,1,1):4, (0,1,0):5, (0,0,1):6, (0,0,0):7} initial_row = [0]*50 + [1] + [0]*50 color_map = {0:"white", 1:"black"} #################### ### HTML Widgets ##... | https://gallery.fastht.ml/split/applications/cellular_automata | FastHTML page |
Text Annotation Web App
This project is a web-based tool for annotating LLM-generated text, built using FastHTML, HTMX, and Tailwind CSS, originally built by Alex Volkov in the fasthtml-examples repo
Key Technologies and Techniques
FastHTML: A Python-based framework for building web applications with a focus on web ... | https://gallery.fastht.ml/info/applications/annotate_text | FastHTML page |
Observable Plot Demo
The data is randomly generated on the server and is fetched on initial page load.
Try opening the browser developer tools and viewing the Network tab to see the data reponse for each http request. | https://gallery.fastht.ml/app/visualizations/observable_plot/ | FastHTML page |
Move the slider to change the graph | https://gallery.fastht.ml/app/visualizations/matplotlib_charts/ | FastHTML page |
Plotly Interactive Charts Demo with FastHTML
Try interacting with the charts by hovering over data points, zooming in and out, panning, rotating (3D), and more!. | https://gallery.fastht.ml/app/visualizations/plotly_charts/ | FastHTML page |
The Bloch Sphere is a 3D visualization of a single quantum state. You can interact with the buttons (Gates) to see how the state changes. See the description below for more information on what each gate represents.
Available gates | https://gallery.fastht.ml/app/visualizations/bloch_sphere/ | Interactive Bloch Sphere |
from fasthtml.common import * import json import httpx # Set up the app, including daisyui and tailwind for the chat component tlink = Script(src="https://cdn.tailwindcss.com?plugins=typography"), dlink = Link(rel="stylesheet", href="https://cdn.jsdelivr.net/npm/[email protected]/dist/full.min.css") def Arrow(arrow, hx... | https://gallery.fastht.ml/code/applications/annotate_text | FastHTML page |
from fasthtml.common import * import json import httpx # Set up the app, including daisyui and tailwind for the chat component tlink = Script(src="https://cdn.tailwindcss.com?plugins=typography"), dlink = Link(rel="stylesheet", href="https://cdn.jsdelivr.net/npm/[email protected]/dist/full.min.css") def Arrow(arrow, hx... | https://gallery.fastht.ml/split/applications/annotate_text | FastHTML page |
from fasthtml.common import * from datetime import date,datetime from monsterui.all import * # fast_app is doing a lot of work here. # It creates a table in the database if it doesn't exist with columns id and title making id the primary key # it returns a connector object todos # it returns a model class Todo app, rt,... | https://gallery.fastht.ml/code/todo_series/intermediate | FastHTML page |
from fasthtml.common import * from datetime import date,datetime from monsterui.all import * # fast_app is doing a lot of work here. # It creates a table in the database if it doesn't exist with columns id and title making id the primary key # it returns a connector object todos # it returns a model class Todo app, rt,... | https://gallery.fastht.ml/split/todo_series/intermediate | FastHTML page |
Intermediate Todo App (SQLite)
This project is a web-based implementation of an intermediate todo app built using FastHTML, HTMX, and SQLite. This builds on the minimal todo app by adding a due date and a done field to todos. Functionality related to these new fields has been added to the app.
Key Technologies and Te... | https://gallery.fastht.ml/info/todo_series/intermediate | FastHTML page |
Minimal Todo App (SQLite)
This project is a web-based implementation of a minimal todo app built using FastHTML, HTMX, and SQLite.
Key Technologies and Techniques
FastHTML: A Python-based framework for building web applications with a focus on web fundamentals.
HTMX: Used to create dynamic server-side content updat... | https://gallery.fastht.ml/info/todo_series/beginner | FastHTML page |
from fasthtml.common import * from fasthtml.svg import * app, rt = fast_app() def mk_shape(shape): if shape == "circle": return Circle(cx=15, cy=15, r=10, fill="red")(hx_get="mk/rect",hx_swap="outerHTML") elif shape == "rect": return Rect(x=10, y=10, width=10, height=10, fill="blue")(hx_get="mk/circle",hx_swap="outerHT... | https://gallery.fastht.ml/code/svg/inb_replacement | FastHTML page |
from fasthtml.common import * from fastsql import * from apswutils.db import NotFoundError app,rt,todos,Todo = fast_app( 'data/todos.db', id=int, title=str, pk='id') def tid(id): return f'todo-{id}' @app.delete("/delete_todo", name='delete_todo') async def delete_todo(id:int): try: todos.delete(id) except NotFoundError... | https://gallery.fastht.ml/code/todo_series/beginner | FastHTML page |
from fasthtml.common import * from fastsql import * from apswutils.db import NotFoundError app,rt,todos,Todo = fast_app( 'data/todos.db', id=int, title=str, pk='id') def tid(id): return f'todo-{id}' @app.delete("/delete_todo", name='delete_todo') async def delete_todo(id:int): try: todos.delete(id) except NotFoundError... | https://gallery.fastht.ml/split/todo_series/beginner | FastHTML page |
Yes, Zig can compile and link to C++ code, allowing you to leverage existing C++ libraries or integrate C++ code within your Zig projects. Here’s how you can do that: ### 1. Using Zig to Call C++ Code To call C++ code from Zig, you typically need to follow these steps: #### Step 1: Create C++ Code You can create a simp... | https://gallery.fastht.ml/app/applications/annotate_text/ | FastHTML page |
from fasthtml.common import * from fasthtml.svg import * app, rt = fast_app() def mk_shape(shape): if shape == "circle": return Circle(cx=15, cy=15, r=10, fill="red")(hx_get="mk/rect",hx_swap="outerHTML") elif shape == "rect": return Rect(x=10, y=10, width=10, height=10, fill="blue")(hx_get="mk/circle",hx_swap="outerHT... | https://gallery.fastht.ml/split/svg/inb_replacement | FastHTML page |
from fasthtml.common import * from fasthtml.svg import * from random import randint from uuid import uuid4 import time timer = {} app, rt = fast_app(hdrs=[Script(src="https://d3js.org/d3.v7.min.js")]) class Timer: def __init__(self): self.start = time.time() def stop(self): self.stop = time.time() return self.stop - se... | https://gallery.fastht.ml/code/svg/find_and_click | FastHTML page |
from fasthtml.common import * from fasthtml.svg import * from random import randint from uuid import uuid4 import time timer = {} app, rt = fast_app(hdrs=[Script(src="https://d3js.org/d3.v7.min.js")]) class Timer: def __init__(self): self.start = time.time() def stop(self): self.stop = time.time() return self.stop - se... | https://gallery.fastht.ml/split/svg/find_and_click | FastHTML page |
from fasthtml.common import * from fasthtml.svg import * app, rt = fast_app(hdrs=[Script(src="https://d3js.org/d3.v7.min.js")]) @rt def index(): return Div( P("Click and drag an SVG rectangle with D3"), Svg(viewBox="0 0 200 200",id="svg-box")( Rect(x=5,y=5,width=10,height=10,fill="red",id="rect")), Script(''' window.on... | https://gallery.fastht.ml/code/svg/click_and_drag | FastHTML page |
from fasthtml.common import * from fasthtml.svg import * app, rt = fast_app(hdrs=[Script(src="https://d3js.org/d3.v7.min.js")]) @rt def index(): return Div( P("Click and drag an SVG rectangle with D3"), Svg(viewBox="0 0 200 200",id="svg-box")( Rect(x=5,y=5,width=10,height=10,fill="red",id="rect")), Script(''' window.on... | https://gallery.fastht.ml/split/svg/click_and_drag | FastHTML page |
from fasthtml.common import * app, rt = fast_app() @rt('/') def homepage(): return Div(*[create_chat_message(**msg, msg_num=i) for i, msg in enumerate(example_messages)]) def create_chat_message(role, content, msg_num): text_color = '#1F2937' match role: case 'system': color = '#8B5CF6' case 'user': color = "#F000B8" c... | https://gallery.fastht.ml/split/widgets/chat_bubble | FastHTML page |
from fasthtml.common import * app, rt = fast_app() @rt('/') def homepage(): return Div(*[create_chat_message(**msg, msg_num=i) for i, msg in enumerate(example_messages)]) def create_chat_message(role, content, msg_num): text_color = '#1F2937' match role: case 'system': color = '#8B5CF6' case 'user': color = "#F000B8" c... | https://gallery.fastht.ml/code/widgets/chat_bubble | FastHTML page |
Click the object to swap it with another shape | https://gallery.fastht.ml/app/svg/inb_replacement/ | FastHTML page |
import base64, requests from fasthtml.common import * app, rt = fast_app() @rt def index(): audio_path = "https://ucarecdn.com/abb35276-b3cb-4a5c-bba0-878f264e5976/AfricanFellaCumbiaDelishort.mp3" return Audio(src=f"data:audio/mp4;base64,{load_audio_base64(audio_path)}", controls=True) def load_audio_base64(audio_path:... | https://gallery.fastht.ml/code/widgets/audio | FastHTML page |
import base64, requests from fasthtml.common import * app, rt = fast_app() @rt def index(): audio_path = "https://ucarecdn.com/abb35276-b3cb-4a5c-bba0-878f264e5976/AfricanFellaCumbiaDelishort.mp3" return Audio(src=f"data:audio/mp4;base64,{load_audio_base64(audio_path)}", controls=True) def load_audio_base64(audio_path:... | https://gallery.fastht.ml/split/widgets/audio | FastHTML page |
from fasthtml.common import * import numpy as np, seaborn as sns, matplotlib.pylab as plt app,rt = fast_app() data = np.random.rand(4,10) def fh_svg(func): "show svg in fasthtml decorator" def wrapper(*args, **kwargs): func(*args, **kwargs) # calls plotting function f = io.StringIO() # create a buffer to store svg data... | https://gallery.fastht.ml/code/visualizations/seaborn_svg | FastHTML page |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.