tempest_fastapi_sdk.ui.layout¶
Layout: os contêineres estruturais em que uma página organiza o conteúdo.
Shell
¶
Bases: Component
The shared page chrome.
Wraps the page content in <header> / <main> / <footer>
landmarks. Use it from a base page's
:meth:~tempest_fastapi_sdk.ui.pages.Page.shell so every concrete
page inherits the same frame through plain Python inheritance.
Attributes:
| Name | Type | Description |
|---|---|---|
children |
list[Widget]
|
The page content, placed in |
header |
Widget | None
|
Content of the |
footer |
Widget | None
|
Content of the |
width |
ShellWidth
|
|
classes |
ComponentClasses
|
Class names to apply. |
Example
from tempest_core import Text, Widget
from tempest_fastapi_sdk.ui.components import NavBar, NavItem
from tempest_fastapi_sdk.ui.layout import Shell
from tempest_fastapi_sdk.ui.pages import Page
class BasePage(Page):
def shell(self, body: Widget) -> Widget:
return Shell(
children=[body],
header=NavBar(items=[NavItem(label="Início", href="/")]),
footer=Text(content="© Tempest", tag="small"),
)
render
¶
Compose the shell.
Returns:
| Name | Type | Description |
|---|---|---|
Widget |
Widget
|
A |
Widget
|
with the content always inside |
Grid
¶
Bases: Component
A CSS grid of equal-width, wrapping columns.
The default min_column_width makes the grid responsive with no
media query: columns fit as many as the width allows and reflow to
one per row on a phone.
Attributes:
| Name | Type | Description |
|---|---|---|
children |
list[Widget]
|
The grid items. |
columns |
int
|
Fixed column count. |
min_column_width |
str
|
Minimum width of an auto-fitted column, as a CSS length. |
gap |
str
|
Gap between items, as a CSS length. |
classes |
ComponentClasses
|
Class names to apply. |
Example
template
¶
Return the grid-template-columns value.
Returns:
| Name | Type | Description |
|---|---|---|
str |
str
|
A fixed |
str
|
otherwise an auto-fitting track. |
render
¶
Compose the grid.
Returns:
| Name | Type | Description |
|---|---|---|
Widget |
Widget
|
A |
Widget
|
track, holding the items unchanged. |