Core API
The nuiitivet package exposes the core primitives, layout widgets, and state management utilities.
nuiitivet package.
Core functionality and configuration primitives are exposed here.
Column
Bases: Widget
Layout children vertically.
Parameters - gap: pixels between children - cross_alignment: 'start'|'center'|'end' for cross-axis (horizontal) alignment - main_alignment: 'start'|'center'|'end'|'space-between'|'space-around'|'space-evenly' - padding: inner padding as int (all sides), (h, v), or (left, top, right, bottom) - overflow: 'visible'|'clip'|'scroll' - how to handle children that overflow the container - 'visible' (default): children may extend beyond container (Phase 1 behavior) - 'clip': children are clipped to container bounds - 'scroll': requires Scroller wrapper (Phase 3)
Source code in src/nuiitivet/layout/column.py
15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 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 138 139 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 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 294 295 296 297 298 299 300 301 302 303 304 305 306 307 | |
__init__(children=None, *, width=None, height=None, padding=0, gap=0, main_alignment='start', cross_alignment='start')
Initialize Column and configure layout.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
children
|
Optional[Sequence[Widget]]
|
List of child widgets to arrange vertically. |
None
|
width
|
SizingLike
|
Column width. |
None
|
height
|
SizingLike
|
Column height. |
None
|
padding
|
Union[int, Tuple[int, int], Tuple[int, int, int, int]]
|
Padding around the content. |
0
|
gap
|
Union[int, ReadOnlyObservableProtocol]
|
Space between children in pixels. |
0
|
main_alignment
|
str
|
Vertical alignment of children. 'start', 'center', 'end', 'space-between', 'space-around', 'space-evenly'. |
'start'
|
cross_alignment
|
str
|
Horizontal alignment of children. 'start', 'center', 'end', 'stretch'. |
'start'
|
Source code in src/nuiitivet/layout/column.py
32 33 34 35 36 37 38 39 40 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 | |
builder(items, builder, *, width=None, height=None, padding=0, gap=0, main_alignment='start', cross_alignment='start')
classmethod
Create a Column that materializes children from items via ForEach.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
items
|
ItemsLike
|
Source data collection. |
required |
builder
|
BuilderFn
|
Function to create a widget for each item. |
required |
width
|
SizingLike
|
Column width. |
None
|
height
|
SizingLike
|
Column height. |
None
|
padding
|
Union[int, Tuple[int, int], Tuple[int, int, int, int]]
|
Padding around the content. |
0
|
gap
|
int
|
Space between children. |
0
|
main_alignment
|
str
|
Vertical alignment of children. |
'start'
|
cross_alignment
|
str
|
Horizontal alignment of children. |
'start'
|
Source code in src/nuiitivet/layout/column.py
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 | |
Row
Bases: Widget
Layout children horizontally.
Parameters - gap: pixels between children - cross_alignment: 'start'|'center'|'end' for cross-axis (vertical) alignment - main_alignment: 'start'|'center'|'end'|'space-between'|'space-around'|'space-evenly' - padding: inner padding as int (all sides), (h, v), or (left, top, right, bottom)
Source code in src/nuiitivet/layout/row.py
15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 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 138 139 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 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 294 295 296 297 298 299 300 301 | |
__init__(children=None, *, width=None, height=None, padding=0, gap=0, main_alignment='start', cross_alignment='start')
Initialize Row and configure layout.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
children
|
Optional[List[Widget]]
|
List of child widgets to arrange horizontally. |
None
|
width
|
SizingLike
|
Row width. Defaults to None (shrinkwrap). |
None
|
height
|
SizingLike
|
Row height. Defaults to None (shrinkwrap). |
None
|
padding
|
Union[int, Tuple[int, int], Tuple[int, int, int, int]]
|
Padding around the content. |
0
|
gap
|
Union[int, ReadOnlyObservableProtocol]
|
Space between children in pixels. |
0
|
main_alignment
|
str
|
Horizontal alignment of children. 'start', 'center', 'end', 'space-between', 'space-around', 'space-evenly'. |
'start'
|
cross_alignment
|
str
|
Vertical alignment of children. 'start', 'center', 'end', 'stretch'. |
'start'
|
Source code in src/nuiitivet/layout/row.py
28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 | |
builder(items, builder, *, width=None, height=None, padding=0, gap=0, main_alignment='start', cross_alignment='start')
classmethod
Create a Row that materializes children from items via ForEach.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
items
|
ItemsLike
|
Source data collection. |
required |
builder
|
BuilderFn
|
Function to create a widget for each item. |
required |
width
|
SizingLike
|
Row width. |
None
|
height
|
SizingLike
|
Row height. |
None
|
padding
|
Union[int, Tuple[int, int], Tuple[int, int, int, int]]
|
Padding around the content. |
0
|
gap
|
int
|
Space between children. |
0
|
main_alignment
|
str
|
Horizontal alignment of children. |
'start'
|
cross_alignment
|
str
|
Vertical alignment of children. |
'start'
|
Source code in src/nuiitivet/layout/row.py
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 | |
Stack
Bases: Widget
Layout children on top of each other.
Parameters - children: List of widgets to stack. - alignment: How to align children within the stack.
Source code in src/nuiitivet/layout/stack.py
15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 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 138 139 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 | |
__init__(children, *, width=None, height=None, padding=0, alignment='top-left')
Initialize the Stack layout.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
children
|
Sequence[Widget]
|
List of widgets to stack on top of each other. |
required |
width
|
SizingLike
|
Stack width. |
None
|
height
|
SizingLike
|
Stack height. |
None
|
padding
|
Union[int, Tuple[int, int], Tuple[int, int, int, int]]
|
Padding around the content. |
0
|
alignment
|
AlignmentLike
|
Default alignment for children. (horizontal, vertical) tuple or string like "top-left", "center". |
'top-left'
|
Source code in src/nuiitivet/layout/stack.py
23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 | |
builder(items, builder, *, width=None, height=None, padding=0, alignment='center')
classmethod
Create a Stack that materializes children from items via ForEach.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
items
|
ItemsLike
|
Source data collection. |
required |
builder
|
BuilderFn
|
Function to create a widget for each item. |
required |
width
|
SizingLike
|
Stack width. |
None
|
height
|
SizingLike
|
Stack height. |
None
|
padding
|
Union[int, Tuple[int, int], Tuple[int, int, int, int]]
|
Padding around the content. |
0
|
alignment
|
AlignmentLike
|
Default alignment for children. |
'center'
|
Source code in src/nuiitivet/layout/stack.py
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 | |
Container
Bases: Widget
Lightweight layout-only Container.
This Container is a minimal single-child layout box. It intentionally does not perform background/shadow/border drawing or clipping.
Source code in src/nuiitivet/layout/container.py
16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 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 138 139 140 141 142 143 144 145 146 147 148 149 150 151 | |
__init__(child=None, *, width=None, height=None, padding=0, alignment='start')
Initialize the Container.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
child
|
Optional[Widget]
|
The child widget to be placed inside the container. |
None
|
width
|
SizingLike
|
The preferred width of the container. Defaults to None (shrinkwrap). |
None
|
height
|
SizingLike
|
The preferred height of the container. Defaults to None (shrinkwrap). |
None
|
padding
|
Union[int, Tuple[int, int], Tuple[int, int, int, int]]
|
Padding to apply around the child. Can be a single integer, a 2-tuple (horizontal, vertical), or a 4-tuple (left, top, right, bottom). |
0
|
alignment
|
Union[str, Tuple[str, str]]
|
How to align the child within the container. Defaults to "start". Can be a string (e.g., "center") or a tuple (horizontal, vertical). |
'start'
|
Source code in src/nuiitivet/layout/container.py
23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 | |
add_child(w)
Keep at most one child; call ChildContainerMixin directly to bypass overrides.
Source code in src/nuiitivet/layout/container.py
58 59 60 | |
Flow
Bases: Widget
Layout children in rows that wrap.
Arranges children in a horizontal run, wrapping to a new line when the line runs out of space.
Source code in src/nuiitivet/layout/flow.py
16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 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 138 139 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 238 239 240 241 242 243 244 245 | |
builder(items, builder, *, main_gap=0, cross_gap=0, padding=0, main_alignment='start', run_alignment='start', cross_alignment='start', width=None, height=None)
classmethod
Create a Flow that materializes children from items via ForEach.
Source code in src/nuiitivet/layout/flow.py
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 | |
UniformFlow
Bases: Widget
Layout children in a uniform grid.
This layout arranges children into columns with equal width.
Source code in src/nuiitivet/layout/uniform_flow.py
19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 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 138 139 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 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 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 | |
builder(items, builder, *, columns=None, max_column_width=None, aspect_ratio=None, main_gap=0, cross_gap=0, padding=0, main_alignment='start', run_alignment='start', item_alignment='stretch', width=None, height=None)
classmethod
Create a UniformFlow that materializes children from items via ForEach.
Source code in src/nuiitivet/layout/uniform_flow.py
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 | |
Grid
Bases: Widget
Two-dimensional layout container with explicit tracks.
Source code in src/nuiitivet/layout/grid.py
125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 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 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 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 | |
__init__(children, rows, columns, *, width=None, height=None, padding=0, row_gap=0, column_gap=0)
Initialize the Grid layout.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
children
|
Optional[Sequence[Widget]]
|
List of GridItems to display. |
required |
rows
|
Optional[Sequence[SizingLike]]
|
List of row sizes (e.g. [100, "1fr", "auto"]). |
required |
columns
|
Optional[Sequence[SizingLike]]
|
List of column sizes. |
required |
width
|
SizingLike
|
Grid container width. |
None
|
height
|
SizingLike
|
Grid container height. |
None
|
padding
|
Union[int, Tuple[int, int], Tuple[int, int, int, int]]
|
Padding around the grid content. |
0
|
row_gap
|
int
|
Vertical gap between rows. |
0
|
column_gap
|
int
|
Horizontal gap between columns. |
0
|
Source code in src/nuiitivet/layout/grid.py
128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 | |
named_areas(children, areas, *, width=None, height=None, padding=0, row_gap=0, column_gap=0, rows=None, columns=None)
classmethod
Create a Grid using named template areas.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
children
|
Sequence[Widget]
|
List of child widgets (usually GridItem.named_area). |
required |
areas
|
Sequence[Sequence[str]]
|
2D list of area names (e.g. [["header", "header"], ["sidebar", "content"]]). |
required |
width
|
SizingLike
|
Grid width. |
None
|
height
|
SizingLike
|
Grid height. |
None
|
padding
|
Union[int, Tuple[int, int], Tuple[int, int, int, int]]
|
Grid padding. |
0
|
row_gap
|
int
|
Gap between rows. |
0
|
column_gap
|
int
|
Gap between columns. |
0
|
rows
|
Optional[Sequence[SizingLike]]
|
Explicit row sizing overrides. |
None
|
columns
|
Optional[Sequence[SizingLike]]
|
Explicit column sizing overrides. |
None
|
Returns:
| Name | Type | Description |
|---|---|---|
Grid |
Grid
|
A configured Grid instance. |
Source code in src/nuiitivet/layout/grid.py
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 | |
GridItem
Bases: Container
Annotate a child with explicit grid placement data.
Source code in src/nuiitivet/layout/grid.py
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 | |
__init__(child, row=None, column=None, *, width=None, height=None, padding=0, alignment='start')
Initialize the GridItem wrapper.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
child
|
Widget
|
The widget to place in the grid. |
required |
row
|
Optional[GridIndex]
|
Row index or (start, end) tuple. 0-based. |
None
|
column
|
Optional[GridIndex]
|
Column index or (start, end) tuple. 0-based. |
None
|
width
|
SizingLike
|
Override width. |
None
|
height
|
SizingLike
|
Override height. |
None
|
padding
|
Union[int, Tuple[int, int], Tuple[int, int, int, int]]
|
Padding around the child within the grid cell. |
0
|
alignment
|
Union[str, Tuple[str, str]]
|
Alignment within the grid cell. Defaults to "start". |
'start'
|
Source code in src/nuiitivet/layout/grid.py
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 | |
named_area(child, name, *, width=None, height=None, padding=0, alignment='start')
classmethod
Create a GridItem placed in a named template area.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
child
|
Widget
|
The child widget to place. |
required |
name
|
str
|
The area name matching a name in Grid.named_areas(). |
required |
width
|
SizingLike
|
Override width. |
None
|
height
|
SizingLike
|
Override height. |
None
|
padding
|
Union[int, Tuple[int, int], Tuple[int, int, int, int]]
|
Padding around the child within the grid cell. |
0
|
alignment
|
Union[str, Tuple[str, str]]
|
Alignment within the grid cell. Defaults to "start". |
'start'
|
Returns:
| Name | Type | Description |
|---|---|---|
GridItem |
GridItem
|
The wrapped widget with area information. |
Source code in src/nuiitivet/layout/grid.py
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 | |
Spacer
Bases: Widget
Invisible widget that reserves space.
This single Spacer supports both fixed-size and flexible behavior.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
width
|
SizingLike
|
preferred width (int, "auto", "{f}%", or Sizing) |
0
|
height
|
SizingLike
|
preferred height (same accepted formats as width) |
0
|
Source code in src/nuiitivet/layout/spacer.py
13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 | |
__init__(*, width=0, height=0)
Initialize a Spacer.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
width
|
SizingLike
|
Preferred width. Use Sizing.flex() or 0 for flexible space. |
0
|
height
|
SizingLike
|
Preferred height. Use Sizing.flex() or 0 for flexible space. |
0
|
Source code in src/nuiitivet/layout/spacer.py
23 24 25 26 27 28 29 30 | |
preferred_size(max_width=None, max_height=None)
Return preferred size based on Sizings.
- fixed: return the fixed value
- auto/flex: return 0 (minimum size, parent will allocate)
Source code in src/nuiitivet/layout/spacer.py
32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 | |
CrossAligned
Bases: Widget
Layout wrapper that overrides cross-axis alignment in Row/Column.
This sets cross_align metadata on the wrapper. Row/Column may read
this to override their cross_alignment for this child only.
Source code in src/nuiitivet/layout/cross_aligned.py
16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 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 | |
__init__(child, alignment)
Initialize the CrossAligned wrapper.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
child
|
Optional[Widget]
|
The child widget to wrap. |
required |
alignment
|
str
|
The cross-axis alignment to apply to this child. Common values: "start", "center", "end", "stretch". |
required |
Source code in src/nuiitivet/layout/cross_aligned.py
23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 | |
Deck
Bases: Widget
Display only one child at a time.
All children remain mounted (state preserved), but only the selected child is visible and rendered.
Usage
Deck(children=[HomeTab(), SearchTab(), ProfileTab()], index=0)
For type-safe index, use IntEnum: class Section(IntEnum): HOME = 0 SEARCH = 1 Deck(children=[...], index=Section.HOME)
For animated tabs with gesture support, see DeckController.
Source code in src/nuiitivet/layout/deck.py
12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 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 138 139 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 | |
current_index
property
Get the currently selected child index.
__init__(children=None, index=0, *, width=None, height=None, padding=0)
Initialize the Deck layout.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
children
|
Optional[Sequence[Widget]]
|
A list of child widgets. All are mounted, but only one is visible. |
None
|
index
|
Union[int, _ObservableValue[int]]
|
The index of the child to display. Can be an integer or an Observable[int]. Defaults to 0. |
0
|
width
|
SizingLike
|
The preferred width of the container. Defaults to None. |
None
|
height
|
SizingLike
|
The preferred height of the container. Defaults to None. |
None
|
padding
|
Union[int, Tuple[int, int], Tuple[int, int, int, int]]
|
Padding to apply around the visible child. Defaults to 0. |
0
|
Source code in src/nuiitivet/layout/deck.py
30 31 32 33 34 35 36 37 38 39 40 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 | |
set_index(index)
Set the selected child index (for non-Observable usage).
Source code in src/nuiitivet/layout/deck.py
94 95 96 97 98 99 100 101 102 | |
layout(width, height)
Layout all children (to preserve state), position selected child.
Source code in src/nuiitivet/layout/deck.py
149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 | |
paint(canvas, x, y, width, height)
Paint only the selected child.
Source code in src/nuiitivet/layout/deck.py
169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 | |
hit_test(x, y)
Only allow hit testing on the selected child.
Source code in src/nuiitivet/layout/deck.py
192 193 194 195 196 197 198 199 200 | |
dispose()
Clean up subscriptions.
Source code in src/nuiitivet/layout/deck.py
202 203 204 205 206 | |
Widget
Bases: BindingHostMixin, LifecycleHostMixin, InputHubMixin, ChildContainerMixin, WidgetKernel
Leaf-friendly widget base composed from mixins.
This class intentionally does not participate in build/recomposition.
Widgets that need build()/rebuild()/scope() must inherit
ComposableWidget.
Source code in src/nuiitivet/widgeting/widget.py
27 28 29 30 31 32 33 34 35 36 37 38 39 40 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 138 139 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 | |
mark_needs_layout()
Mark this widget as needing layout recalculation.
Source code in src/nuiitivet/widgeting/widget.py
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 | |
find_ancestor(widget_type)
Find the nearest ancestor of the specified type.
Traverses up the widget tree looking for an ancestor that matches the given type. This is used to implement context lookup patterns like Navigator.of(context).
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
widget_type
|
Type[T]
|
The type of widget to find. |
required |
Returns:
| Type | Description |
|---|---|
Optional[T]
|
The nearest ancestor of the specified type, or None if not found. |
Example
navigator = self.find_ancestor(Navigator) if navigator: navigator.push(...)
Source code in src/nuiitivet/widgeting/widget.py
120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 | |
modifier(modifier)
Apply a modifier to this widget, returning the wrapped result.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
modifier
|
Union[Modifier, ModifierElement]
|
The modifier (or modifier element) to apply. |
required |
Returns:
| Type | Description |
|---|---|
Widget
|
The wrapped widget (e.g. ModifierBox) or the widget itself if modified in-place. |
Source code in src/nuiitivet/widgeting/widget.py
145 146 147 148 149 150 151 152 153 154 | |
ComposableWidget
Bases: BuilderHostMixin, Widget
Widget base that participates in build/recomposition.
Composition widgets can override build() and use scope() /
render_scope() for fine-grained recomposition.
Source code in src/nuiitivet/widgeting/widget.py
236 237 238 239 240 241 | |
Navigator
Bases: ComposableWidget
A minimal navigation stack.
Initialization forms
Navigator(screen): start with a single screen (RouteorWidget).Navigator.routes([...]): pre-populated stack (e.g. deep linking).Navigator.intents(initial_route=..., routes={...}): Intent-based routing.
Features
- push/pop
- root()/set_root()
- of(context)
- optional fade-in on push
Source code in src/nuiitivet/navigation/navigator.py
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 138 139 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 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 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 | |
__init__(screen=None, *, layer_composer=None)
Initialize a Navigator with a single initial screen.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
screen
|
Route | Widget | None
|
The initial screen as a |
None
|
layer_composer
|
NavigationLayerComposer | None
|
Optional custom layer composer. |
None
|
Source code in src/nuiitivet/navigation/navigator.py
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 | |
routes(screens, *, layer_composer=None)
classmethod
Create a Navigator with a pre-populated stack.
Use this when the navigator should start with multiple screens already on the stack (e.g. deep linking, state restoration).
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
screens
|
Sequence[Route | Widget]
|
Sequence of |
required |
layer_composer
|
NavigationLayerComposer | None
|
Optional custom layer composer. |
None
|
Source code in src/nuiitivet/navigation/navigator.py
103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 | |
intents(*, initial_route, routes, layer_composer=None)
classmethod
Create a Navigator configured for Intent-based routing.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
initial_route
|
Any
|
The initial Intent instance used to resolve the first route. |
required |
routes
|
Mapping[type[Any], Callable[[Any], Route | Widget]]
|
Mapping of Intent types to route builder functions. Each
builder returns a |
required |
layer_composer
|
NavigationLayerComposer | None
|
Optional custom layer composer. |
None
|
Source code in src/nuiitivet/navigation/navigator.py
127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 | |
request_back()
Request a single back action.
This API is designed for user back inputs (Esc/back button). If a pop transition is already running, the request is queued and the current transition is completed immediately.
Queue consumption policy: - Intermediate queued pops are performed without animation. - The last queued pop (if any) uses the normal pop behavior.
Source code in src/nuiitivet/navigation/navigator.py
284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 | |
PageRoute
Bases: Route
Route for a page widget.
Source code in src/nuiitivet/navigation/route.py
38 39 40 41 42 | |
Observable
Bases: _ObservableValue[T]
Descriptor for a per-instance observable that can also be used standalone.
Source code in src/nuiitivet/observable/value.py
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 | |
DefaultTitleBar
Bases: TitleBar
Configuration for the default OS title bar.
Attributes:
| Name | Type | Description |
|---|---|---|
title |
The window title. |
|
icon |
Path to the window icon. |
Source code in src/nuiitivet/runtime/title_bar.py
21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 | |
CustomTitleBar
Bases: TitleBar
Configuration for a custom title bar.
Source code in src/nuiitivet/runtime/title_bar.py
41 42 43 44 45 46 47 48 49 50 51 52 | |
__init__(content, title=None)
Initialize with custom content.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
content
|
Widget
|
The widget to render as the title bar. |
required |
title
|
Optional[str]
|
The window title (used for taskbar/dock, but not rendered by OS). |
None
|
Source code in src/nuiitivet/runtime/title_bar.py
44 45 46 47 48 49 50 51 52 | |
batch()
Context manager for batching Observable updates.
Source code in src/nuiitivet/observable/batching.py
77 78 79 80 81 82 | |
set_default_font_family(family_name)
Set the system-wide default font family.
This font will be prioritized over locale-based defaults. Pass None to reset to automatic locale detection.
Source code in src/nuiitivet/rendering/skia/font.py
32 33 34 35 36 37 38 39 | |