tempestweb.components¶
Ready-made Material 3 fields, forms and buttons, including the Brazilian ones (CPF, CNPJ, phone, address) and the validators that go with them. These are content components; the screen's frame comes from tempestweb.presets or is assembled by you.
Guide with examples: Ready-made components.
tempestweb.components ¶
tempestweb.components — ready-to-use fields, forms and Material 3 buttons.
Pre-built, validated building blocks so an app declares a field, a button or a whole form in one line instead of wiring inputs, labels, errors and validators by hand:
from tempestweb.components import EmailField, PasswordField, LoginForm
from tempestweb.components import filled_button, text_button
EmailField/PasswordField and TextField are tempestweb-native, styled
Material 3 against the theme they are given; the BR fields
(:class:PhoneField/:class:CPFField/:class:CNPJField/:class:AddressField)
wrap the core's masked inputs. The *_button helpers build the MD3 button
variants. Everything renders identically in Mode A (WASM) and Mode B (server).
Pass theme=app.theme to a field or a form exactly as you would to a widget:
the theme reaches the Input each field builds, the fields and submit button
each form builds, and the colour of every label and error line.
EmailField ¶
Bases: Component
A labelled, Material 3 e-mail field that follows the theme it is given.
The tempestweb-native e-mail field: a muted label, a controlled
:class:~tempest_core.widgets.inputs.Input on the e-mail keyboard, and an
optional error line. tempest-core resolves the Input's outlined Material 3
style inline against theme, so it matches the rest of a tempestweb UI
in light and in dark alike.
Validate with :func:validate_email.
Attributes:
| Name | Type | Description |
|---|---|---|
value |
str
|
The current e-mail value (controlled). |
label |
str
|
The label shown above the field (omitted when empty). |
placeholder |
str
|
The empty-field hint. |
error |
str
|
The validation message; shown in the theme's error colour. |
on_change |
Callable[[str], Any]
|
Called with the new string value on each edit. |
theme |
Theme
|
The theme the input, label and error line resolve against. |
Source code in tempestweb/components/fields.py
render ¶
Lower the e-mail field into a labelled column wrapping an Input.
Returns:
| Name | Type | Description |
|---|---|---|
A |
Widget
|
class: |
Widget
|
input, and the optional error line. |
Source code in tempestweb/components/fields.py
PasswordField ¶
Bases: Component
A labelled, secure password field that follows the theme it is given.
Like :class:EmailField but the input is secure (masked). It carries no
inline style of its own: the core resolves the outlined Material 3 treatment
from theme, so the field is light in a light app and dark in a dark one.
Attributes:
| Name | Type | Description |
|---|---|---|
value |
str
|
The current password value (controlled). |
label |
str
|
The label shown above the field (omitted when empty). |
placeholder |
str
|
The empty-field hint. |
error |
str
|
The validation message; shown in the theme's error colour. |
on_change |
Callable[[str], Any]
|
Called with the new string value on each edit. |
theme |
Theme
|
The theme the input, label and error line resolve against. |
Source code in tempestweb/components/fields.py
render ¶
Lower the password field into a labelled column wrapping an Input.
Returns:
| Name | Type | Description |
|---|---|---|
A |
Widget
|
class: |
Widget
|
input, and the optional error line. |
Source code in tempestweb/components/fields.py
TextField ¶
Bases: Component
A generic labelled text field for arbitrary input (name, title, …).
The general-purpose sibling of the BR-specific fields: a label, a controlled
text :class:~tempest_core.Input, and an optional error message. Controlled —
pass value and an on_change that stores the new string.
Attributes:
| Name | Type | Description |
|---|---|---|
value |
str
|
The current text value (controlled). |
label |
str
|
The label shown above the field (omitted when empty). |
placeholder |
str
|
The empty-field hint. |
error |
str
|
The validation message; shown in the theme's error colour. |
on_change |
Callable[[str], Any]
|
Called with the new string value on each edit. |
theme |
Theme
|
The theme the input, label and error line resolve against. |
Source code in tempestweb/components/fields.py
211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 | |
render ¶
Lower the field into a labelled column wrapping a text Input.
The inner widgets' keys are derived from this component's key. They
used to be literals, so two fields on the same screen shared the key of
the Input that actually emits the events and the router could not
tell them apart — an edit applied to the wrong field, silently.
Returns:
| Name | Type | Description |
|---|---|---|
A |
Widget
|
class: |
Widget
|
input, and the optional error line. |
Source code in tempestweb/components/fields.py
LoginForm ¶
Bases: Component
A complete email + password login form with a submit button.
The app keeps email/password in its state and updates them via the
on_*_change handlers; on_submit fires when the button is pressed (the
app reads the current values from its state and performs the login). Pass
email_error/password_error to surface validation messages.
Example
Attributes:
| Name | Type | Description |
|---|---|---|
email |
str
|
The current e-mail value (controlled). |
password |
str
|
The current password value (controlled). |
on_email_change |
Callable[[str], Any]
|
Called with the new e-mail string on each edit. |
on_password_change |
Callable[[str], Any]
|
Called with the new password string on each edit. |
on_submit |
Callable[[], Any]
|
Called when the submit button is pressed. |
email_error |
str
|
Validation message under the e-mail field (shown when set). |
password_error |
str
|
Validation message under the password field. |
title |
str
|
Optional heading shown above the fields. |
submit_label |
str
|
The submit button label. |
theme |
Theme
|
The theme handed to every field and to the submit button. |
Source code in tempestweb/components/forms.py
41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 | |
render ¶
Lay out the title, fields and submit button in a column.
Returns:
| Name | Type | Description |
|---|---|---|
A |
Widget
|
class: |
Widget
|
e-mail and password fields, and the submit button. |
Source code in tempestweb/components/forms.py
SignupForm ¶
Bases: Component
An email + password + confirm-password sign-up form with a submit button.
Like :class:LoginForm it is controlled: the app holds the three values in
state and updates them via the on_*_change handlers. on_submit fires
when the button is pressed; surface validation via the *_error fields
(e.g. set confirm_error when the passwords differ).
Attributes:
| Name | Type | Description |
|---|---|---|
email |
str
|
The current e-mail value (controlled). |
password |
str
|
The current password value (controlled). |
confirm |
str
|
The current confirm-password value (controlled). |
on_email_change |
Callable[[str], Any]
|
Called with the new e-mail string on each edit. |
on_password_change |
Callable[[str], Any]
|
Called with the new password string on each edit. |
on_confirm_change |
Callable[[str], Any]
|
Called with the new confirm-password string on each edit. |
on_submit |
Callable[[], Any]
|
Called when the submit button is pressed. |
email_error |
str
|
Validation message under the e-mail field. |
password_error |
str
|
Validation message under the password field. |
confirm_error |
str
|
Validation message under the confirm-password field. |
title |
str
|
Optional heading shown above the fields. |
submit_label |
str
|
The submit button label. |
theme |
Theme
|
The theme handed to every field and to the submit button. |
Source code in tempestweb/components/forms.py
140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 | |
render ¶
Lay out the title, fields and submit button in a column.
Returns:
| Name | Type | Description |
|---|---|---|
A |
Widget
|
class: |
Widget
|
password and confirm-password fields, and the submit button. |
Source code in tempestweb/components/forms.py
elevated_button ¶
elevated_button(label: str, on_click: Callable[[], Any] | None = None, *, key: str | None = None) -> Button
Build a Material 3 elevated button — a filled button with a resting shadow.
The core has no elevated variant, so this layers a small inline
:class:~tempest_core.style.Shadow over the SOLID / primary fill; the
core merges the shadow override onto the variant-resolved base style.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
label
|
str
|
The button text. |
required |
on_click
|
Callable[[], Any] | None
|
Handler fired when the button is pressed. |
None
|
key
|
str | None
|
Optional reconciler key. |
None
|
Returns:
| Name | Type | Description |
|---|---|---|
A |
Button
|
class: |
Source code in tempestweb/components/buttons.py
filled_button ¶
filled_button(label: str, on_click: Callable[[], Any] | None = None, *, key: str | None = None) -> Button
Build a Material 3 filled button — the high-emphasis default.
Delegates to the core SOLID variant on the primary color scheme, so
the primary fill and white label come from the core's resolved style.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
label
|
str
|
The button text. |
required |
on_click
|
Callable[[], Any] | None
|
Handler fired when the button is pressed. |
None
|
key
|
str | None
|
Optional reconciler key. |
None
|
Returns:
| Name | Type | Description |
|---|---|---|
A |
Button
|
class: |
Source code in tempestweb/components/buttons.py
outlined_button ¶
outlined_button(label: str, on_click: Callable[[], Any] | None = None, *, key: str | None = None) -> Button
Build a Material 3 outlined button — medium emphasis with a border.
Delegates to the core OUTLINE variant, whose resolved style draws the
primary-toned border.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
label
|
str
|
The button text. |
required |
on_click
|
Callable[[], Any] | None
|
Handler fired when the button is pressed. |
None
|
key
|
str | None
|
Optional reconciler key. |
None
|
Returns:
| Name | Type | Description |
|---|---|---|
A |
Button
|
class: |
Source code in tempestweb/components/buttons.py
text_button ¶
text_button(label: str, on_click: Callable[[], Any] | None = None, *, key: str | None = None) -> Button
Build a Material 3 text button — low emphasis, no border.
Delegates to the core GHOST variant, the lowest-emphasis button: a bare
label with no border, the base sheet's state layer still tinting it on
hover/press.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
label
|
str
|
The button text. |
required |
on_click
|
Callable[[], Any] | None
|
Handler fired when the button is pressed. |
None
|
key
|
str | None
|
Optional reconciler key. |
None
|
Returns:
| Name | Type | Description |
|---|---|---|
A |
Button
|
class: |
Source code in tempestweb/components/buttons.py
tonal_button ¶
tonal_button(label: str, on_click: Callable[[], Any] | None = None, *, key: str | None = None) -> Button
Build a Material 3 filled tonal button — medium emphasis.
Delegates to the core SOLID variant on the secondary color scheme for
a lower-emphasis, secondary-toned fill.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
label
|
str
|
The button text. |
required |
on_click
|
Callable[[], Any] | None
|
Handler fired when the button is pressed. |
None
|
key
|
str | None
|
Optional reconciler key. |
None
|
Returns:
| Name | Type | Description |
|---|---|---|
A |
Button
|
class: |