- Add PLAN.md with 40-step checklist across 10 phases - Add CLAUDE.md with project-specific instructions - Set up nix flake with FastHTML/MonsterUI dependencies - Create Python package skeleton (src/animaltrack) - Vendor FastHTML and MonsterUI documentation - Add Docker build configuration 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
5.3 KiB
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('25'), Td('New York')),
Tr(Td('Bob'), Td('30'), Td('San Francisco')),
Tr(Td('Charlie'), Td('35'), Td('London'))),
Tfoot(Tr(Td('Total'), Td('90'))))
[/code]
See Source
See Output
| Name | Age | City |
|---|---|---|
| Alice | 25 | New York |
| Bob | 30 | San Francisco |
| Charlie | 35 | London |
| Total | 90 | |
| [code] |
def ex_tables1():
header = ['Name', 'Age', 'City']
body = [['Alice', '25', 'New York'],
['Bob', '30', 'San Francisco'],
['Charlie', '35', 'London']]
footer = ['Total', '90']
return TableFromLists(header, body, footer)
[/code]
See Source
See Output
| NAME | AGE | CITY |
|---|---|---|
| Alice | 30 years | New York |
| Bob | 25 years | London |
| [code] |
def ex_tables2():
def body_render(k, v):
match k.lower():
case 'name': return Td(v, cls='font-bold')
case 'age': return Td(f"{v} years")
case _: return Td(v)
header_data = ['Name', 'Age', 'City']
body_data =[{'Name': 'Alice', 'Age': 30, 'City': 'New York'},
{'Name': 'Bob', 'Age': 25, 'City': 'London'}]
return TableFromDicts(header_data, body_data,
header_cell_render=lambda v: Th(v.upper()),
body_cell_render=body_render)
[/code]
Table
Source
[code]
Table(*c, cls=(<TableT.middle: 'uk-table-middle'>, <TableT.divider: 'uk-table-divider'>, <TableT.hover: 'uk-table-hover'>, <TableT.sm: 'uk-table-sm'>), **kwargs) -> fastcore.xml.FT
[/code]
Creates a table
Params
-
cComponents (typicallyThead,Tbody,Tfoot) -
clsAdditional classes on the table -
kwargs
Returns: Table component
TableFromLists
Source
[code]
TableFromLists(header_data: Sequence, body_data: Sequence[Sequence], footer_data=None, header_cell_render=<function Th at 0x752645f859e0>, body_cell_render=<function Td at 0x752645f85940>, footer_cell_render=<function Td at 0x752645f85940>, cls=(<TableT.middle: 'uk-table-middle'>, <TableT.divider: 'uk-table-divider'>, <TableT.hover: 'uk-table-hover'>, <TableT.sm: 'uk-table-sm'>), sortable=False, **kwargs) -> fastcore.xml.FT
[/code]
Creates a Table from a list of header data and a list of lists of body data
Params
-
header_dataList of header data -
body_dataList of lists of body data -
footer_dataList of footer data -
header_cell_renderFunction(content) -> FT that renders header cells -
body_cell_renderFunction(key, content) -> FT that renders body cells -
footer_cell_renderFunction(key, content) -> FT that renders footer cells -
clsAdditional classes on the table -
sortableWhether to use sortable table -
kwargs
Returns: Table from lists
TableFromDicts
Source
[code]
TableFromDicts(header_data: Sequence, body_data: Sequence[dict], footer_data=None, header_cell_render=<function Th at 0x752645f859e0>, body_cell_render=<function <lambda> at 0x752645f85b20>, footer_cell_render=<function <lambda> at 0x752645f85bc0>, cls=(<TableT.middle: 'uk-table-middle'>, <TableT.divider: 'uk-table-divider'>, <TableT.hover: 'uk-table-hover'>, <TableT.sm: 'uk-table-sm'>), sortable=False, **kwargs) -> fastcore.xml.FT
[/code]
Creates a Table from a list of header data and a list of dicts of body data
Params
-
header_dataList of header data -
body_dataList of dicts of body data -
footer_dataList of footer data -
header_cell_renderFunction(content) -> FT that renders header cells -
body_cell_renderFunction(key, content) -> FT that renders body cells -
footer_cell_renderFunction(key, content) -> FT that renders footer cells -
clsAdditional classes on the table -
sortableWhether to use sortable table -
kwargs
Returns: Styled Table
TableT
__
| Option | Value | Option | Value | Option | Value |
|---|---|---|---|---|---|
| divider | uk-table-divider | striped | uk-table-striped | hover | uk-table-hover |
| sm | uk-table-sm | lg | uk-table-lg | justify | uk-table-justify |
| middle | uk-table-middle | responsive | uk-table-responsive |
Tbody
Source
[code]
Tbody(*rows, cls=(), sortable=False, **kwargs)
[/code]
Params
-
rows -
cls -
sortable -
kwargs
Th
Source
[code]
Th(*c, cls=(), shrink=False, expand=False, small=False)
[/code]
Params
-
cComponents that go in the cell -
clsAdditional classes on the cell container -
shrinkWhether to shrink the cell -
expandWhether to expand the cell -
smallWhether to use a small table
Returns: Table cell
Td
Source
[code]
Td(*c, cls=(), shrink=False, expand=False, small=False)
[/code]
Params
-
cComponents that go in the cell -
clsAdditional classes on the cell container -
shrinkWhether to shrink the cell -
expandWhether to expand the cell -
smallWhether to use a small table
Returns: Table cell