Material Components¶
High-level widgets implementing Material Design 3.
material
¶
Material design system root.
This is the single public import root for Material apps. It re-exports every
core symbol from :mod:nuiitivet and adds the Material widgets/styles, so a
single import gives access to everything::
import nuiitivet.material as nv
nv.Column(...) # core symbol
nv.Button(...) # material symbol
Deep imports (nuiitivet.material.buttons, nuiitivet.material.styles.*,
...) are internal and unsupported.
ButtonSize
module-attribute
¶
M3 button size preset.
FabSize
module-attribute
¶
Framework-unified FAB size preset.
The literal values follow the project-wide s/m/l convention rather
than the MD3 spec wording (FAB / Medium FAB / Large FAB):
"s"corresponds to the baseline 56dp FAB (MD3 "FAB")."m"corresponds to the 80dp Medium FAB."l"corresponds to the 96dp Large FAB.
The deprecated 40dp Small FAB is intentionally not represented.
ButtonGroupPosition
module-attribute
¶
Position of a segment within a ButtonGroup.
LargeBadge
¶
LargeBadge(text: str, *, padding: Union[int, Tuple[int, int], Tuple[int, int, int, int], None] = None, style: Optional[LargeBadgeStyle] = None, key: Optional[str] = None)
Bases: Box
Large text badge widget.
Initialize LargeBadge.
The height is MD3-fixed (spec) and the width is content-driven, so
neither is a constructor parameter; customize the height via style
(SIZE_POLICY: MD3 fixes the axis -> style only).
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
text
|
str
|
Badge text to display. Must be non-empty. |
required |
padding
|
Union[int, Tuple[int, int], Tuple[int, int, int, int], None]
|
External badge padding. Defaults to style padding. |
None
|
style
|
Optional[LargeBadgeStyle]
|
Optional style override. |
None
|
key
|
Optional[str]
|
Stable widget identity for dev-bridge targeting and hot reload. |
None
|
Source code in src/nuiitivet/material/badge.py
stick_modifier
¶
stick_modifier(*, badge: Optional[Widget] = None) -> StickModifier
Create a spec-aligned stick modifier for attaching this large badge.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
badge
|
Optional[Widget]
|
Optional badge widget to place. Defaults to this badge instance. |
None
|
Returns:
| Type | Description |
|---|---|
StickModifier
|
Stick modifier configured for MD3-like large badge placement. |
Source code in src/nuiitivet/material/badge.py
SmallBadge
¶
SmallBadge(*, padding: Union[int, Tuple[int, int], Tuple[int, int, int, int]] = 0, style: Optional[SmallBadgeStyle] = None, key: Optional[str] = None)
Bases: Box
Small dot badge widget.
Initialize SmallBadge.
The dot dimensions are MD3-fixed (spec size tokens), so they are not
constructor parameters; customize them via style instead
(SIZE_POLICY: MD3 fixes the axis -> style only).
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
padding
|
Union[int, Tuple[int, int], Tuple[int, int, int, int]]
|
External badge padding. |
0
|
style
|
Optional[SmallBadgeStyle]
|
Optional style override. |
None
|
key
|
Optional[str]
|
Stable widget identity for dev-bridge targeting and hot reload. |
None
|
Source code in src/nuiitivet/material/badge.py
stick_modifier
¶
stick_modifier(*, badge: Optional[Widget] = None) -> StickModifier
Create a spec-aligned stick modifier for attaching this small badge.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
badge
|
Optional[Widget]
|
Optional badge widget to place. Defaults to this badge instance. |
None
|
Returns:
| Type | Description |
|---|---|
StickModifier
|
Stick modifier configured for MD3-like small badge placement. |
Source code in src/nuiitivet/material/badge.py
App
¶
App(window: Window, *, theme: Optional[Any] = None, exit_policy: ExitPolicy = LAST_WINDOW_CLOSED, tray: Optional[TrayIcon] = None)
Bases: App
Material Design application runner.
Takes its main window as the first argument and supplies the Material
default theme. Through the public surface the window is a
:class:~nuiitivet.material.window.MaterialWindow:
nv.App(nv.Window(content=...)). Secondary windows are constructed
with nv.Window(...) and shown with window.open().
Initialize a MaterialApp.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
window
|
Window
|
The main window, typically a
:class: |
required |
theme
|
Optional[Any]
|
The MaterialThemeFactory to use. Defaults to Light theme. |
None
|
exit_policy
|
ExitPolicy
|
When :meth: |
LAST_WINDOW_CLOSED
|
tray
|
Optional[TrayIcon]
|
A :class: |
None
|
Source code in src/nuiitivet/material/app.py
HorizontalDivider
¶
HorizontalDivider(*, width: SizingLike = None, padding: PaddingLike = 0, style: Optional[DividerStyle] = None, key: Optional[str] = None)
Bases: _DividerBase
Material Design 3 horizontal divider.
Draws a full-width line to separate content. Only width is exposed;
the height (thickness) is derived from the style.
Initialize HorizontalDivider.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
width
|
SizingLike
|
Width sizing override. Defaults to |
None
|
padding
|
PaddingLike
|
Padding around the divider line. |
0
|
style
|
Optional[DividerStyle]
|
Optional :class: |
None
|
key
|
Optional[str]
|
Stable widget identity for dev-bridge targeting and hot reload. |
None
|
Source code in src/nuiitivet/material/divider.py
VerticalDivider
¶
VerticalDivider(*, height: SizingLike = None, padding: PaddingLike = 0, style: Optional[DividerStyle] = None, key: Optional[str] = None)
Bases: _DividerBase
Material Design 3 vertical divider.
Draws a full-height line to separate content. Only height is exposed;
the width (thickness) is derived from the style.
Initialize VerticalDivider.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
height
|
SizingLike
|
Height sizing override. Defaults to |
None
|
padding
|
PaddingLike
|
Padding around the divider line. |
0
|
style
|
Optional[DividerStyle]
|
Optional :class: |
None
|
key
|
Optional[str]
|
Stable widget identity for dev-bridge targeting and hot reload. |
None
|
Source code in src/nuiitivet/material/divider.py
Button
¶
Button(label: str | ReadOnlyObservableProtocol[str] | None = None, icon: 'Symbol' | str | ReadOnlyObservableProtocol['Symbol'] | ReadOnlyObservableProtocol[str] | None = None, *, on_click: Optional[VoidCallback] = None, disabled: bool | ObservableProtocol[bool] = False, width: SizingLike = None, padding: Optional[Union[int, Tuple[int, int, int, int]]] = None, style: Optional[ButtonStyle] = None, key: Optional[str] = None)
Bases: MaterialButtonBase
Unified Material Design 3 button.
The visual variant (filled, outlined, text, elevated, tonal) and the
M3 size preset ("xs".."xl") are both expressed through the
style argument, which accepts any :class:ButtonStyle instance.
Use the :class:ButtonStyle factory methods to obtain variant presets:
ButtonStyle.filled("s"), ButtonStyle.outlined("m") and so on.
When style is not provided, :meth:ButtonStyle.filled with size
"s" is used as the default.
Initialize Button.
The height is MD3-fixed by the style's size variant, so it is not a
constructor parameter; select it through style (e.g.
ButtonStyle.filled("m")) — SIZE_POLICY: MD3 fixes the axis -> style
only.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
label
|
str | ReadOnlyObservableProtocol[str] | None
|
Text label for the button. |
None
|
icon
|
'Symbol' | str | ReadOnlyObservableProtocol['Symbol'] | ReadOnlyObservableProtocol[str] | None
|
Icon glyph for the button (Symbol, string, or observable). |
None
|
on_click
|
Optional[VoidCallback]
|
Callback invoked when the button is clicked. |
None
|
disabled
|
bool | ObservableProtocol[bool]
|
Whether the button is disabled. |
False
|
width
|
SizingLike
|
Width specification. Defaults to auto. |
None
|
padding
|
Optional[Union[int, Tuple[int, int, int, int]]]
|
Padding override; |
None
|
style
|
Optional[ButtonStyle]
|
Visual style preset. Defaults to |
None
|
key
|
Optional[str]
|
Stable widget identity for dev-bridge targeting and hot reload. |
None
|
Source code in src/nuiitivet/material/buttons.py
ExtendedFab
¶
ExtendedFab(label: str | ReadOnlyObservableProtocol[str], *, icon: 'Symbol' | str | ReadOnlyObservableProtocol['Symbol'] | ReadOnlyObservableProtocol[str] | None = None, on_click: Optional[VoidCallback] = None, expanded: bool | ObservableProtocol[bool] = True, disabled: bool | ObservableProtocol[bool] = False, style: Optional[FabStyle] = None, key: Optional[str] = None)
Bases: _FabBase
Material Design 3 Extended FAB with a collapse/expand state.
A pill-shaped FAB carrying a required label and an optional leading
icon. The expanded observable morphs the button between the
extended pill (icon + label) and a collapsed circular FAB (icon only).
The width is content-driven when expanded and animates down to the
circular container footprint when collapsed.
When icon is omitted the collapse is a no-op: the button stays a
label pill because there is nothing to show in the circular footprint.
Initialize ExtendedFab.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
label
|
str | ReadOnlyObservableProtocol[str]
|
Required text label (string or observable). |
required |
icon
|
'Symbol' | str | ReadOnlyObservableProtocol['Symbol'] | ReadOnlyObservableProtocol[str] | None
|
Optional leading icon. When present, the collapsed state shows it as a circular FAB; when absent, collapse is a no-op. |
None
|
on_click
|
Optional[VoidCallback]
|
Callback invoked when the button is clicked. |
None
|
expanded
|
bool | ObservableProtocol[bool]
|
Initial expanded state or external observable. |
True
|
disabled
|
bool | ObservableProtocol[bool]
|
Whether the button is disabled. |
False
|
style
|
Optional[FabStyle]
|
FAB style preset selecting the colour mapping and size.
Defaults to the theme's FAB style, which itself falls back to
:meth: |
None
|
key
|
Optional[str]
|
Stable widget identity for dev-bridge targeting and hot reload. |
None
|
Source code in src/nuiitivet/material/buttons.py
1379 1380 1381 1382 1383 1384 1385 1386 1387 1388 1389 1390 1391 1392 1393 1394 1395 1396 1397 1398 1399 1400 1401 1402 1403 1404 1405 1406 1407 1408 1409 1410 1411 1412 1413 1414 1415 1416 1417 1418 1419 1420 1421 1422 1423 1424 1425 1426 1427 1428 1429 1430 1431 1432 1433 1434 1435 1436 1437 1438 1439 1440 1441 1442 1443 1444 1445 1446 1447 1448 1449 1450 1451 1452 1453 1454 1455 1456 1457 1458 1459 1460 1461 1462 | |
expanded
property
writable
¶
Return whether the button is currently expanded (pill) state.
Fab
¶
Fab(icon: 'Symbol' | str | ReadOnlyObservableProtocol['Symbol'] | ReadOnlyObservableProtocol[str], *, on_click: Optional[VoidCallback] = None, disabled: bool | ObservableProtocol[bool] = False, padding: Optional[Union[int, Tuple[int, int, int, int]]] = None, style: Optional[FabStyle] = None, key: Optional[str] = None)
Bases: _FabBase
Material Design 3 Floating Action Button (FAB).
Initialize Fab.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
icon
|
'Symbol' | str | ReadOnlyObservableProtocol['Symbol'] | ReadOnlyObservableProtocol[str]
|
Icon for the button. |
required |
on_click
|
Optional[VoidCallback]
|
Callback to be invoked when the button is clicked. |
None
|
disabled
|
bool | ObservableProtocol[bool]
|
Whether the button is disabled. |
False
|
padding
|
Optional[Union[int, Tuple[int, int, int, int]]]
|
Padding specification. When |
None
|
style
|
Optional[FabStyle]
|
FAB style preset. Defaults to the theme's FAB style, which
itself falls back to :meth: |
None
|
key
|
Optional[str]
|
Stable widget identity for dev-bridge targeting and hot reload. |
None
|
Source code in src/nuiitivet/material/buttons.py
IconButton
¶
IconButton(icon: 'Symbol' | str | ReadOnlyObservableProtocol['Symbol'] | ReadOnlyObservableProtocol[str], *, on_click: Optional[VoidCallback] = None, disabled: bool | ObservableProtocol[bool] = False, style: Optional[ButtonStyle] = None, key: Optional[str] = None)
Bases: MaterialButtonBase
Material icon-only action button driven by style presets.
Initialize IconButton.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
icon
|
'Symbol' | str | ReadOnlyObservableProtocol['Symbol'] | ReadOnlyObservableProtocol[str]
|
Icon glyph source. |
required |
on_click
|
Optional[VoidCallback]
|
Callback invoked when the button is clicked. |
None
|
disabled
|
bool | ObservableProtocol[bool]
|
Whether the button is disabled. |
False
|
style
|
Optional[ButtonStyle]
|
Icon button style preset or custom style. Defaults to
:meth: |
None
|
key
|
Optional[str]
|
Stable widget identity for dev-bridge targeting and hot reload. |
None
|
Source code in src/nuiitivet/material/buttons.py
IconToggleButton
¶
IconToggleButton(icon: 'Symbol' | str | ReadOnlyObservableProtocol['Symbol'] | ReadOnlyObservableProtocol[str], *, selected: bool | ObservableProtocol[bool] = False, on_change: Optional[BoolCallback] = None, disabled: bool | ObservableProtocol[bool] = False, style: Optional[IconToggleButtonStyle] = None, key: Optional[str] = None)
Bases: ToggleButtonBase
Material icon-only toggle button driven by state-paired styles.
Initialize IconToggleButton.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
icon
|
'Symbol' | str | ReadOnlyObservableProtocol['Symbol'] | ReadOnlyObservableProtocol[str]
|
Icon glyph source. |
required |
selected
|
bool | ObservableProtocol[bool]
|
Selected state value or observable. |
False
|
on_change
|
Optional[BoolCallback]
|
Callback invoked with the new selected state. |
None
|
disabled
|
bool | ObservableProtocol[bool]
|
Whether the button is disabled. |
False
|
style
|
Optional[IconToggleButtonStyle]
|
Toggle style pair for selected and unselected states.
Defaults to the theme's icon toggle button style, which itself
falls back to :meth: |
None
|
key
|
Optional[str]
|
Stable widget identity for dev-bridge targeting and hot reload. |
None
|
Source code in src/nuiitivet/material/buttons.py
ToggleButton
¶
ToggleButton(label: str | ReadOnlyObservableProtocol[str] | None = None, icon: 'Symbol' | str | ReadOnlyObservableProtocol['Symbol'] | ReadOnlyObservableProtocol[str] | None = None, *, selected: bool | ObservableProtocol[bool] = False, on_change: Optional[BoolCallback] = None, disabled: bool | ObservableProtocol[bool] = False, width: SizingLike = None, padding: Optional[Union[int, Tuple[int, int, int, int]]] = None, style: Optional[ToggleButtonStyle] = None, key: Optional[str] = None)
Bases: ToggleButtonBase
Unified Material Design 3 toggle button.
Visual variant and size are encoded in a :class:ToggleButtonStyle
which carries both unselected- and selected-state colours. Use
:meth:ToggleButtonStyle.filled, .outlined, .elevated or
.tonal to obtain presets. When style is None, the style
defaults to :meth:ToggleButtonStyle.filled at size "s".
Initialize ToggleButton.
The height is MD3-fixed by the style's size variant, so it is not a
constructor parameter; select it through style (e.g.
ToggleButtonStyle.filled("m")) — SIZE_POLICY: MD3 fixes the axis ->
style only.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
label
|
str | ReadOnlyObservableProtocol[str] | None
|
Text label for the button. |
None
|
icon
|
'Symbol' | str | ReadOnlyObservableProtocol['Symbol'] | ReadOnlyObservableProtocol[str] | None
|
Icon glyph for the button. |
None
|
selected
|
bool | ObservableProtocol[bool]
|
Initial selected state or external observable. |
False
|
on_change
|
Optional[BoolCallback]
|
Callback invoked with the new selected value. |
None
|
disabled
|
bool | ObservableProtocol[bool]
|
Whether the button is disabled. |
False
|
width
|
SizingLike
|
Width specification. |
None
|
padding
|
Optional[Union[int, Tuple[int, int, int, int]]]
|
Padding override; |
None
|
style
|
Optional[ToggleButtonStyle]
|
Toggle style preset. Defaults to the theme's toggle button
style, which itself falls back to |
None
|
key
|
Optional[str]
|
Stable widget identity for dev-bridge targeting and hot reload. |
None
|
Source code in src/nuiitivet/material/buttons.py
ButtonStyle
dataclass
¶
ButtonStyle(background: Optional[ColorSpec] = None, foreground: Optional[ColorSpec] = None, border_color: Optional[ColorSpec] = None, border_width: float = 0.0, corner_radius: int = 20, container_height: int = 40, padding: PaddingLike = (16, 0, 16, 0), spacing: int = 8, min_width: int = 64, min_height: int = 48, label_font_size: int = 14, icon_size: int = 20, elevation: int = 0, overlay_color: Optional[ColorSpec] = None, overlay_alpha: float = 0.0)
Immutable style for the :class:Button widget (M3-compliant).
Use the filled / outlined / text / elevated / tonal
factory classmethods (each accepting a :data:ButtonSize) rather than
constructing directly where possible.
copy_with
¶
Create a new style instance with specified fields changed.
Returns the caller's own type, so a :class:FabStyle copy is still a
:class:FabStyle.
Source code in src/nuiitivet/material/styles/button_style.py
resolve_colors
¶
resolve_colors(theme: Theme | None = None) -> dict
Resolve :class:ColorRole entries to concrete RGBA values.
Source code in src/nuiitivet/material/styles/button_style.py
resolve
¶
resolve(theme: Theme | None = None) -> dict
Compatibility resolver returning a dict shaped like the legacy style.
Source code in src/nuiitivet/material/styles/button_style.py
filled
classmethod
¶
filled(size: ButtonSize = 's') -> ButtonStyle
Return the filled-variant style at the given M3 size.
Source code in src/nuiitivet/material/styles/button_style.py
outlined
classmethod
¶
outlined(size: ButtonSize = 's') -> ButtonStyle
Return the outlined-variant style at the given M3 size.
Source code in src/nuiitivet/material/styles/button_style.py
text
classmethod
¶
text(size: ButtonSize = 's') -> ButtonStyle
Return the text-variant style at the given M3 size.
Source code in src/nuiitivet/material/styles/button_style.py
elevated
classmethod
¶
elevated(size: ButtonSize = 's') -> ButtonStyle
Return the elevated-variant style at the given M3 size.
Source code in src/nuiitivet/material/styles/button_style.py
tonal
classmethod
¶
tonal(size: ButtonSize = 's') -> ButtonStyle
Return the tonal-variant style at the given M3 size.
Source code in src/nuiitivet/material/styles/button_style.py
IconButtonStyle
¶
Preset factories for icon-only button styles.
Each factory accepts a :data:ButtonSize argument that drives container
size, icon size, corner radius, and outline width from
:data:ICON_BUTTON_SIZE_TOKENS. Defaults to "s" (40dp).
standard
classmethod
¶
standard(size: ButtonSize = 's') -> ButtonStyle
Return the standard icon-button style at the given M3 size.
Source code in src/nuiitivet/material/styles/button_style.py
filled
classmethod
¶
filled(size: ButtonSize = 's') -> ButtonStyle
Return the filled icon-button style at the given M3 size.
Source code in src/nuiitivet/material/styles/button_style.py
outlined
classmethod
¶
outlined(size: ButtonSize = 's') -> ButtonStyle
Return the outlined icon-button style at the given M3 size.
Source code in src/nuiitivet/material/styles/button_style.py
tonal
classmethod
¶
tonal(size: ButtonSize = 's') -> ButtonStyle
Return the tonal icon-button style at the given M3 size.
Source code in src/nuiitivet/material/styles/button_style.py
vibrant
classmethod
¶
vibrant(size: ButtonSize = 's') -> ButtonStyle
Return the vibrant icon-button style at the given M3 size.
Intended for use on vibrant containers such as a vibrant toolbar.
Source code in src/nuiitivet/material/styles/button_style.py
filled_vibrant
classmethod
¶
filled_vibrant(size: ButtonSize = 's') -> ButtonStyle
Return the filled vibrant icon-button style at the given M3 size.
Source code in src/nuiitivet/material/styles/button_style.py
outlined_vibrant
classmethod
¶
outlined_vibrant(size: ButtonSize = 's') -> ButtonStyle
Return the outlined vibrant icon-button style at the given M3 size.
Source code in src/nuiitivet/material/styles/button_style.py
tonal_vibrant
classmethod
¶
tonal_vibrant(size: ButtonSize = 's') -> ButtonStyle
Return the tonal vibrant icon-button style at the given M3 size.
Source code in src/nuiitivet/material/styles/button_style.py
IconToggleButtonStyle
dataclass
¶
IconToggleButtonStyle(selected: ButtonStyle, unselected: ButtonStyle)
State-paired style for icon toggle button widgets.
standard
classmethod
¶
standard(size: ButtonSize = 's') -> IconToggleButtonStyle
Return styles for the standard icon-toggle button variant.
Source code in src/nuiitivet/material/styles/button_style.py
filled
classmethod
¶
filled(size: ButtonSize = 's') -> IconToggleButtonStyle
Return styles for the filled icon-toggle button variant.
Source code in src/nuiitivet/material/styles/button_style.py
outlined
classmethod
¶
outlined(size: ButtonSize = 's') -> IconToggleButtonStyle
Return styles for the outlined icon-toggle button variant.
Source code in src/nuiitivet/material/styles/button_style.py
tonal
classmethod
¶
tonal(size: ButtonSize = 's') -> IconToggleButtonStyle
Return styles for the tonal icon-toggle button variant.
Source code in src/nuiitivet/material/styles/button_style.py
preset
classmethod
¶
preset() -> IconToggleButtonStyle
Return the framework preset, ignoring any theme.
This is what an icon toggle button renders with before it is mounted,
and what :meth:from_theme falls back to when no Material theme is
installed.
Returns:
| Type | Description |
|---|---|
IconToggleButtonStyle
|
The standard icon-toggle style at size |
Source code in src/nuiitivet/material/styles/button_style.py
from_theme
classmethod
¶
from_theme(theme: Theme) -> IconToggleButtonStyle
Resolve the icon-toggle style from theme.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
theme
|
Theme
|
Theme instance. |
required |
Returns:
| Type | Description |
|---|---|
IconToggleButtonStyle
|
Resolved icon-toggle style. |
Source code in src/nuiitivet/material/styles/button_style.py
FabStyle
dataclass
¶
FabStyle(background: Optional[ColorSpec] = None, foreground: Optional[ColorSpec] = None, border_color: Optional[ColorSpec] = None, border_width: float = 0.0, corner_radius: int = 20, container_height: int = 40, padding: PaddingLike = (16, 0, 16, 0), spacing: int = 8, min_width: int = 64, min_height: int = 48, label_font_size: int = 14, icon_size: int = 20, elevation: int = 0, overlay_color: Optional[ColorSpec] = None, overlay_alpha: float = 0.0, focus_opacity: float = 0.1, hover_opacity: float = 0.08, pressed_opacity: float = 0.1, focused_elevation: int = 3, hovered_elevation: int = 4, pressed_elevation: int = 3)
Bases: ButtonStyle
Style preset used by the :class:Fab widget.
Inherits the field set of :class:ButtonStyle so that Fab can reuse
the shared resolve_button_style_params machinery without changes.
primary
classmethod
¶
Return the tonal-primary FAB style at the given size.
Source code in src/nuiitivet/material/styles/fab_style.py
secondary
classmethod
¶
Return the tonal-secondary FAB style at the given size.
Source code in src/nuiitivet/material/styles/fab_style.py
tertiary
classmethod
¶
Return the tonal-tertiary FAB style at the given size.
Source code in src/nuiitivet/material/styles/fab_style.py
primary_solid
classmethod
¶
Return the solid-primary FAB style at the given size.
Source code in src/nuiitivet/material/styles/fab_style.py
secondary_solid
classmethod
¶
Return the solid-secondary FAB style at the given size.
Source code in src/nuiitivet/material/styles/fab_style.py
tertiary_solid
classmethod
¶
Return the solid-tertiary FAB style at the given size.
Source code in src/nuiitivet/material/styles/fab_style.py
preset
classmethod
¶
preset() -> FabStyle
Return the framework preset, ignoring any theme.
This is what a FAB renders with before it is mounted, and what
:meth:from_theme falls back to when no Material theme is installed.
Returns:
| Type | Description |
|---|---|
FabStyle
|
The tonal-primary FAB style at size |
Source code in src/nuiitivet/material/styles/fab_style.py
from_theme
classmethod
¶
Resolve the FAB style from theme.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
theme
|
Theme
|
Theme instance. |
required |
Returns:
| Type | Description |
|---|---|
FabStyle
|
Resolved FAB style. |
Source code in src/nuiitivet/material/styles/fab_style.py
ToggleButtonStyle
dataclass
¶
ToggleButtonStyle(container_height: int = 40, corner_radius: int = 20, padding: PaddingLike = (16, 0, 16, 0), spacing: int = 8, min_width: int = 64, min_height: int = 48, label_font_size: int = 14, icon_size: int = 20, border_width: float = 0.0, elevation: int = 0, unselected_background: Optional[ColorSpec] = None, unselected_foreground: Optional[ColorSpec] = None, unselected_border_color: Optional[ColorSpec] = None, unselected_overlay_color: Optional[ColorSpec] = None, unselected_overlay_alpha: float = 0.08, selected_background: Optional[ColorSpec] = None, selected_foreground: Optional[ColorSpec] = None, selected_border_color: Optional[ColorSpec] = None, selected_overlay_color: Optional[ColorSpec] = None, selected_overlay_alpha: float = 0.08)
Immutable style for :class:ToggleButton (M3-compliant).
Stores a single flat set of shape/size tokens plus two paired colour
groups: unselected_* and selected_*. The :meth:for_selected
helper projects the style into a :class:ButtonStyle for the active
state, so the widget internals can reuse the normal Button machinery.
copy_with
¶
for_selected
¶
for_selected(selected: bool) -> ButtonStyle
Project this style into a :class:ButtonStyle for the given state.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
selected
|
bool
|
When |
required |
Source code in src/nuiitivet/material/styles/toggle_button_style.py
filled
classmethod
¶
filled(size: ButtonSize = 's') -> 'ToggleButtonStyle'
Return the filled toggle-button style at the given M3 size.
Source code in src/nuiitivet/material/styles/toggle_button_style.py
outlined
classmethod
¶
outlined(size: ButtonSize = 's') -> 'ToggleButtonStyle'
Return the outlined toggle-button style at the given M3 size.
Source code in src/nuiitivet/material/styles/toggle_button_style.py
elevated
classmethod
¶
elevated(size: ButtonSize = 's') -> 'ToggleButtonStyle'
Return the elevated toggle-button style at the given M3 size.
Source code in src/nuiitivet/material/styles/toggle_button_style.py
tonal
classmethod
¶
tonal(size: ButtonSize = 's') -> 'ToggleButtonStyle'
Return the tonal toggle-button style at the given M3 size.
Source code in src/nuiitivet/material/styles/toggle_button_style.py
preset
classmethod
¶
Return the framework preset, ignoring any theme.
This is what a toggle button renders with before it is mounted, and
what :meth:from_theme falls back to when no Material theme is
installed.
Returns:
| Type | Description |
|---|---|
'ToggleButtonStyle'
|
The filled toggle-button style at size |
Source code in src/nuiitivet/material/styles/toggle_button_style.py
from_theme
classmethod
¶
Resolve the toggle-button style from theme.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
theme
|
'Theme'
|
Theme instance. |
required |
Returns:
| Type | Description |
|---|---|
'ToggleButtonStyle'
|
Resolved toggle-button style. |
Source code in src/nuiitivet/material/styles/toggle_button_style.py
Card
¶
Card(child: ChildSpec, *, width: SizingLike = None, height: SizingLike = None, padding: PaddingLike = 0, alignment: AlignmentLike = 'start', style: Optional[CardStyle] = None, key: Optional[str] = None)
Bases: ComposableWidget, Box
Unified Material Design 3 card.
The visual variant (filled, outlined, elevated) is expressed entirely
through the style argument, which accepts any :class:CardStyle
instance. Use the :class:CardStyle factory methods to obtain
variant presets: CardStyle.filled(), CardStyle.outlined(),
CardStyle.elevated().
When style is not provided, the theme's filled card style is used
as the default.
Initialize Card.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
child
|
ChildSpec
|
The child widget or factory. |
required |
width
|
SizingLike
|
Width specification. |
None
|
height
|
SizingLike
|
Height specification. |
None
|
padding
|
PaddingLike
|
Padding around the content. |
0
|
alignment
|
AlignmentLike
|
Alignment of the content. |
'start'
|
style
|
Optional[CardStyle]
|
Visual style preset. Defaults to the theme's filled card
style. Use :meth: |
None
|
key
|
Optional[str]
|
Stable widget identity for dev-bridge targeting and hot reload. |
None
|
Source code in src/nuiitivet/material/card.py
style
property
¶
style: CardStyle
Return the style currently in effect.
This is the explicit style when one was given, otherwise the theme's
filled card style — pushed in by :meth:on_mount and kept current by the
theme subscription. It is not pulled from Theme.of, which cannot
answer before the card is attached.
CardStyle
dataclass
¶
CardStyle(background: Optional[ColorSpec] = None, border_color: Optional[ColorSpec] = None, border_width: float = 0.0, border_radius: Union[float, tuple[float, float, float, float]] = 12.0, elevation: int = 0)
Immutable style for Card widgets (M3-compliant).
resolve_colors
¶
resolve_colors(theme: Theme | None = None) -> dict
Resolve ColorRole to concrete color values.
Source code in src/nuiitivet/material/styles/card_style.py
outlined
classmethod
¶
outlined() -> CardStyle
Create a default style for an outlined card.
Source code in src/nuiitivet/material/styles/card_style.py
from_theme
classmethod
¶
Resolve the default :class:CardStyle for the given theme.
Returns the theme's filled card style if a Material theme extension
is present, otherwise a fresh :meth:filled preset.
Source code in src/nuiitivet/material/styles/card_style.py
AssistChip
¶
AssistChip(label: str | ReadOnlyObservableProtocol[str], *, leading_icon: 'Symbol' | str | ReadOnlyObservableProtocol['Symbol'] | ReadOnlyObservableProtocol[str] | None = None, on_click: Optional[Callable[[], None]] = None, disabled: bool | ObservableProtocol[bool] = False, width: SizingLike = None, padding: Optional[Union[int, Tuple[int, int], Tuple[int, int, int, int]]] = None, style: Optional['ChipStyle'] = None, key: Optional[str] = None)
Bases: MaterialChipBase
Material Design 3 Assist Chip widget.
Initialize AssistChip.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
label
|
str | ReadOnlyObservableProtocol[str]
|
Chip label. |
required |
leading_icon
|
'Symbol' | str | ReadOnlyObservableProtocol['Symbol'] | ReadOnlyObservableProtocol[str] | None
|
Optional leading icon. |
None
|
on_click
|
Optional[Callable[[], None]]
|
Click callback. |
None
|
disabled
|
bool | ObservableProtocol[bool]
|
Disabled flag. |
False
|
width
|
SizingLike
|
Width sizing. |
None
|
padding
|
Optional[Union[int, Tuple[int, int], Tuple[int, int, int, int]]]
|
External insets around chip widget. |
None
|
style
|
Optional['ChipStyle']
|
Optional chip style. |
None
|
key
|
Optional[str]
|
Stable widget identity for dev-bridge targeting and hot reload. |
None
|
Source code in src/nuiitivet/material/chip.py
FilterChip
¶
FilterChip(label: str | ReadOnlyObservableProtocol[str], *, selected: bool | ObservableProtocol[bool] = False, on_selected_change: Optional[Callable[[bool], None]] = None, leading_icon: 'Symbol' | str | ReadOnlyObservableProtocol['Symbol'] | ReadOnlyObservableProtocol[str] | None = None, on_click: Optional[Callable[[], None]] = None, disabled: bool | ObservableProtocol[bool] = False, width: SizingLike = None, padding: Optional[Union[int, Tuple[int, int], Tuple[int, int, int, int]]] = None, style: Optional['ChipStyle'] = None, key: Optional[str] = None)
Bases: MaterialChipBase
Material Design 3 Filter Chip widget.
Initialize FilterChip.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
label
|
str | ReadOnlyObservableProtocol[str]
|
Chip label. |
required |
selected
|
bool | ObservableProtocol[bool]
|
Selected state source. |
False
|
on_selected_change
|
Optional[Callable[[bool], None]]
|
Callback when selected state changes. |
None
|
leading_icon
|
'Symbol' | str | ReadOnlyObservableProtocol['Symbol'] | ReadOnlyObservableProtocol[str] | None
|
Optional leading icon in unselected state. |
None
|
on_click
|
Optional[Callable[[], None]]
|
Additional click callback. |
None
|
disabled
|
bool | ObservableProtocol[bool]
|
Disabled flag. |
False
|
width
|
SizingLike
|
Width sizing. |
None
|
padding
|
Optional[Union[int, Tuple[int, int], Tuple[int, int, int, int]]]
|
External insets around chip widget. |
None
|
style
|
Optional['ChipStyle']
|
Optional chip style. |
None
|
key
|
Optional[str]
|
Stable widget identity for dev-bridge targeting and hot reload. |
None
|
Source code in src/nuiitivet/material/chip.py
InputChip
¶
InputChip(label: str | ReadOnlyObservableProtocol[str], *, trailing_icon: 'Symbol' | str | ReadOnlyObservableProtocol['Symbol'] | ReadOnlyObservableProtocol[str], leading_icon: 'Symbol' | str | ReadOnlyObservableProtocol['Symbol'] | ReadOnlyObservableProtocol[str] | None = None, on_trailing_icon_click: Optional[Callable[[], None]] = None, on_click: Optional[Callable[[], None]] = None, disabled: bool | ObservableProtocol[bool] = False, width: SizingLike = None, padding: Optional[Union[int, Tuple[int, int], Tuple[int, int, int, int]]] = None, style: Optional['ChipStyle'] = None, key: Optional[str] = None)
Bases: MaterialChipBase
Material Design 3 Input Chip widget.
Initialize InputChip.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
label
|
str | ReadOnlyObservableProtocol[str]
|
Chip label. |
required |
trailing_icon
|
'Symbol' | str | ReadOnlyObservableProtocol['Symbol'] | ReadOnlyObservableProtocol[str]
|
Required trailing icon. |
required |
leading_icon
|
'Symbol' | str | ReadOnlyObservableProtocol['Symbol'] | ReadOnlyObservableProtocol[str] | None
|
Optional leading icon. |
None
|
on_trailing_icon_click
|
Optional[Callable[[], None]]
|
Callback invoked when trailing icon is pressed. |
None
|
on_click
|
Optional[Callable[[], None]]
|
Click callback. |
None
|
disabled
|
bool | ObservableProtocol[bool]
|
Disabled flag. |
False
|
width
|
SizingLike
|
Width sizing. |
None
|
padding
|
Optional[Union[int, Tuple[int, int], Tuple[int, int, int, int]]]
|
External insets around chip widget. |
None
|
style
|
Optional['ChipStyle']
|
Optional chip style. |
None
|
key
|
Optional[str]
|
Stable widget identity for dev-bridge targeting and hot reload. |
None
|
Source code in src/nuiitivet/material/chip.py
SuggestionChip
¶
SuggestionChip(label: str | ReadOnlyObservableProtocol[str], *, leading_icon: 'Symbol' | str | ReadOnlyObservableProtocol['Symbol'] | ReadOnlyObservableProtocol[str] | None = None, on_click: Optional[Callable[[], None]] = None, disabled: bool | ObservableProtocol[bool] = False, width: SizingLike = None, padding: Optional[Union[int, Tuple[int, int], Tuple[int, int, int, int]]] = None, style: Optional['ChipStyle'] = None, key: Optional[str] = None)
Bases: MaterialChipBase
Material Design 3 Suggestion Chip widget.
Initialize SuggestionChip.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
label
|
str | ReadOnlyObservableProtocol[str]
|
Chip label. |
required |
leading_icon
|
'Symbol' | str | ReadOnlyObservableProtocol['Symbol'] | ReadOnlyObservableProtocol[str] | None
|
Optional leading icon. |
None
|
on_click
|
Optional[Callable[[], None]]
|
Click callback. |
None
|
disabled
|
bool | ObservableProtocol[bool]
|
Disabled flag. |
False
|
width
|
SizingLike
|
Width sizing. |
None
|
padding
|
Optional[Union[int, Tuple[int, int], Tuple[int, int, int, int]]]
|
External insets around chip widget. |
None
|
style
|
Optional['ChipStyle']
|
Optional chip style. |
None
|
key
|
Optional[str]
|
Stable widget identity for dev-bridge targeting and hot reload. |
None
|
Source code in src/nuiitivet/material/chip.py
BasicDialog
¶
BasicDialog(title: Optional[Union[str, ReadOnlyObservableProtocol[str]]] = None, message: Optional[Union[str, ReadOnlyObservableProtocol[str]]] = None, *, icon: Optional[Union[str, 'Symbol', ReadOnlyObservableProtocol[str], ReadOnlyObservableProtocol['Symbol']]] = None, actions: Optional[List[Widget]] = None, style: Optional[DialogStyle] = None, width: float = 280.0, key: Optional[str] = None)
Bases: ComposableWidget
Material dialog widget (Basic Dialog).
Displays a modal dialog with optional icon, title, content, and action buttons. Follows Material Design 3 dialog guidelines.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
title
|
Optional[Union[str, ReadOnlyObservableProtocol[str]]]
|
Optional title text (str or Observable). |
None
|
message
|
Optional[Union[str, ReadOnlyObservableProtocol[str]]]
|
Optional message text (str or Observable). |
None
|
icon
|
Optional[Union[str, 'Symbol', ReadOnlyObservableProtocol[str], ReadOnlyObservableProtocol['Symbol']]]
|
Optional icon (str, Symbol, or Observable). |
None
|
actions
|
Optional[List[Widget]]
|
list of action widgets (typically TextButtons). |
None
|
style
|
Optional[DialogStyle]
|
Optional DialogStyle. If None, uses theme default. |
None
|
width
|
float
|
Container width in dp. Per MD3 the basic dialog width is between
|
280.0
|
Initialize BasicDialog.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
title
|
Optional[Union[str, ReadOnlyObservableProtocol[str]]]
|
Optional title text source. |
None
|
message
|
Optional[Union[str, ReadOnlyObservableProtocol[str]]]
|
Optional message text source. |
None
|
icon
|
Optional[Union[str, 'Symbol', ReadOnlyObservableProtocol[str], ReadOnlyObservableProtocol['Symbol']]]
|
Optional icon source. |
None
|
actions
|
Optional[List[Widget]]
|
Optional action widgets (typically buttons). |
None
|
style
|
Optional[DialogStyle]
|
Optional dialog style override. |
None
|
width
|
float
|
Container width in dp (MD3 range: 280-560). Defaults to 280. |
280.0
|
key
|
Optional[str]
|
Stable widget identity for dev-bridge targeting and hot reload. |
None
|
Source code in src/nuiitivet/material/dialogs.py
LoadingIndicator
¶
LoadingIndicator(*, size: int = 48, padding: Optional[Tuple[int, int, int, int] | Tuple[int, int] | int] = 0, style: Optional[LoadingIndicatorStyle] = None, key: Optional[str] = None)
Bases: Widget
M3 Expressive loading indicator.
This widget is intended for short, indeterminate waits.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
size
|
int
|
Outer size of the indicator (default 48). Sets both width and height. |
48
|
style
|
Optional[LoadingIndicatorStyle]
|
Style configuration for appearance and animation. |
None
|
padding
|
Optional[Tuple[int, int, int, int] | Tuple[int, int] | int]
|
Padding around the indicator. |
0
|
Initialize the LoadingIndicator.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
size
|
int
|
Outer size of the indicator (default 48). |
48
|
padding
|
Optional[Tuple[int, int, int, int] | Tuple[int, int] | int]
|
Padding around the indicator. |
0
|
style
|
Optional[LoadingIndicatorStyle]
|
Style configuration for appearance and animation. |
None
|
key
|
Optional[str]
|
Stable widget identity for dev-bridge targeting and hot reload. |
None
|
Source code in src/nuiitivet/material/loading_indicator.py
CircularProgressIndicator
¶
CircularProgressIndicator(value: float | ObservableProtocol[float] = 0.0, *, disabled: bool | ObservableProtocol[bool] = False, size: int | None = None, padding: PaddingArg = 0, style: CircularProgressIndicatorStyle | None = None, key: str | None = None)
Bases: _DeterminateProgressBase
Material Design 3 determinate circular progress indicator.
Initialize CircularProgressIndicator.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
value
|
float | ObservableProtocol[float]
|
Progress value in range |
0.0
|
disabled
|
bool | ObservableProtocol[bool]
|
Disabled state. |
False
|
size
|
int | None
|
Outer indicator size in dp. Uses style default when omitted. |
None
|
padding
|
PaddingArg
|
Padding around the indicator. |
0
|
style
|
CircularProgressIndicatorStyle | None
|
Optional style override. |
None
|
key
|
str | None
|
Stable widget identity for dev-bridge targeting and hot reload. |
None
|
Source code in src/nuiitivet/material/progress_indicators.py
style
property
¶
Return effective circular progress indicator style.
IndeterminateCircularProgressIndicator
¶
IndeterminateCircularProgressIndicator(*, disabled: bool | ObservableProtocol[bool] = False, size: int | None = None, padding: PaddingArg = 0, style: CircularProgressIndicatorStyle | None = None, key: str | None = None)
Bases: _IndeterminateProgressBase
Material Design 3 indeterminate circular progress indicator.
Initialize IndeterminateCircularProgressIndicator.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
disabled
|
bool | ObservableProtocol[bool]
|
Disabled state. |
False
|
size
|
int | None
|
Outer indicator size in dp. Uses style default when omitted. |
None
|
padding
|
PaddingArg
|
Padding around the indicator. |
0
|
style
|
CircularProgressIndicatorStyle | None
|
Optional style override. |
None
|
key
|
str | None
|
Stable widget identity for dev-bridge targeting and hot reload. |
None
|
Source code in src/nuiitivet/material/progress_indicators.py
style
property
¶
Return effective circular progress indicator style.
IndeterminateLinearProgressIndicator
¶
IndeterminateLinearProgressIndicator(*, disabled: bool | ObservableProtocol[bool] = False, width: SizingLike = 'wt', padding: PaddingArg = 0, style: LinearProgressIndicatorStyle | None = None, key: str | None = None)
Bases: _IndeterminateProgressBase
Material Design 3 indeterminate linear progress indicator.
Initialize IndeterminateLinearProgressIndicator.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
disabled
|
bool | ObservableProtocol[bool]
|
Disabled state. |
False
|
width
|
SizingLike
|
Width sizing. |
'wt'
|
padding
|
PaddingArg
|
Padding around the indicator. |
0
|
style
|
LinearProgressIndicatorStyle | None
|
Optional style override. |
None
|
key
|
str | None
|
Stable widget identity for dev-bridge targeting and hot reload. |
None
|
Source code in src/nuiitivet/material/progress_indicators.py
style
property
¶
style: LinearProgressIndicatorStyle
Return effective linear progress indicator style.
LinearProgressIndicator
¶
LinearProgressIndicator(value: float | ObservableProtocol[float] = 0.0, *, disabled: bool | ObservableProtocol[bool] = False, width: SizingLike = 'wt', padding: PaddingArg = 0, style: LinearProgressIndicatorStyle | None = None, key: str | None = None)
Bases: _DeterminateProgressBase
Material Design 3 determinate linear progress indicator.
Initialize LinearProgressIndicator.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
value
|
float | ObservableProtocol[float]
|
Progress value in range |
0.0
|
disabled
|
bool | ObservableProtocol[bool]
|
Disabled state. |
False
|
width
|
SizingLike
|
Width sizing. |
'wt'
|
padding
|
PaddingArg
|
Padding around the indicator. |
0
|
style
|
LinearProgressIndicatorStyle | None
|
Optional style override. |
None
|
key
|
str | None
|
Stable widget identity for dev-bridge targeting and hot reload. |
None
|
Source code in src/nuiitivet/material/progress_indicators.py
style
property
¶
style: LinearProgressIndicatorStyle
Return effective linear progress indicator style.
Menu
¶
Menu(items: list[MenuItem | SubMenuItem | MenuDivider], *, on_dismiss: Callable[[], None] | None = None, style: MenuStyle | None = None, autofocus: bool = True, parent_item: 'SubMenuItem | None' = None, key: str | None = None)
Bases: InteractiveWidget
Material Design 3 vertical menu popup surface.
The menu is a focus traversal group. Opening a popup moves the focus onto the menu surface, with no item current — nothing is highlighted, as in a desktop menu — unless it was opened from the keyboard, which focuses the first enabled item. Up/Down rove the items (wrapping), Tab/Shift+Tab rove them too (without wrapping) and dismiss the popup once they step past the end, Right/Left walk into and out of a submenu, and Escape dismisses.
An inline menu (one placed in the page rather than shown as an overlay) is a single Tab stop instead: Tab enters it, roves it, and leaves it for the next widget rather than dismissing anything.
Initialize Menu.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
items
|
list[MenuItem | SubMenuItem | MenuDivider]
|
Flat menu entries list. |
required |
on_dismiss
|
Callable[[], None] | None
|
Called when menu is dismissed by keyboard. |
None
|
style
|
MenuStyle | None
|
Optional menu style override. |
None
|
autofocus
|
bool
|
Whether opening the menu focuses its first enabled item. |
True
|
parent_item
|
'SubMenuItem | None'
|
The SubMenuItem this menu expands from, if it is a submenu. |
None
|
key
|
str | None
|
Stable widget identity for dev-bridge targeting and hot reload. |
None
|
Source code in src/nuiitivet/material/menu.py
should_show_focus_ring
property
¶
Never ring the surface: it holds the focus, but the items show where it is.
style
property
¶
Return the menu style currently in effect, pulled from the theme.
A menu has no build(), so it reads the theme where the style is
consumed -- :meth:preferred_size. The read registers a dependency, so
a theme change re-measures the menu and lands back here with the new
value. The container visuals and the items' styles are derived from it
rather than re-derived on every read, so they are re-applied whenever
the resolved style has moved.
focus_first_item
¶
Focus the first enabled item.
Returns False if the menu has no enabled item, or if it is not mounted
yet: a widget's on_mount runs before its children's, so in that case
the request is latched and :meth:_item_mounted completes it.
Source code in src/nuiitivet/material/menu.py
MenuDivider
¶
Sentinel that renders a horizontal divider inside a Menu.
MenuItem
¶
MenuItem(label: str, *, on_click: Callable[[], None] | None = None, disabled: bool = False, leading_icon: Symbol | str | None = None, trailing: Symbol | str | None = None, key: str | None = None)
Bases: InteractiveWidget
Material Design 3 menu item widget.
Initialize MenuItem.
The item height is MD3-fixed (list-item token), so it is not a
constructor parameter; customize it via MenuStyle.item_height
(SIZE_POLICY: MD3 fixes the axis -> style only).
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
label
|
str
|
Item label. |
required |
on_click
|
Callable[[], None] | None
|
Click callback. |
None
|
disabled
|
bool
|
Whether this item is disabled. |
False
|
leading_icon
|
Symbol | str | None
|
Optional leading icon. |
None
|
trailing
|
Symbol | str | None
|
Optional trailing icon (Symbol) or trailing text (str). |
None
|
key
|
str | None
|
Stable widget identity for dev-bridge targeting and hot reload. |
None
|
Source code in src/nuiitivet/material/menu.py
SubMenuItem
¶
SubMenuItem(label: str, items: list[MenuItem | 'SubMenuItem' | MenuDivider], *, leading_icon: Symbol | str | None = None, disabled: bool = False, key: str | None = None)
Bases: MenuItem
Material Design 3 submenu item that expands a nested menu.
Initialize SubMenuItem.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
label
|
str
|
Item label. |
required |
items
|
list[MenuItem | 'SubMenuItem' | MenuDivider]
|
Submenu entries. |
required |
leading_icon
|
Symbol | str | None
|
Optional leading icon. |
None
|
disabled
|
bool
|
Whether this item is disabled. |
False
|
key
|
str | None
|
Stable widget identity for dev-bridge targeting and hot reload. |
None
|
Source code in src/nuiitivet/material/menu.py
FabMenu
¶
FabMenu(icon: IconLike, items: List[FabMenuItem], *, is_open: Optional[Observable[bool]] = None, auto_close: bool = True, close_icon: Union['Symbol', str] = close, style: Optional[FabStyle] = None, key: Optional[str] = None)
Bases: Widget
Material Design 3 Expressive FAB Menu.
A Floating Action Button that expands into a vertical list of labelled
actions. A single is_open observable is the source of truth. On open
the FAB morphs into the MD3 close button: its icon changes (icon ->
close_icon) and it shrinks from its closed size to a fixed 56dp (size
"s") fully-rounded circle, regardless of the configured size. The overlay
-- scrim, outside-tap dismissal, and anchored positioning -- is driven
through the same observable via
:func:~nuiitivet.modifiers.popup.popup.
The closed-size footprint is reserved for layout stability; the shrinking
close button aligns to its top-trailing corner, so larger closed FAB sizes
place the menu higher with a larger margin underneath (40dp for medium, 56dp
for large per MD3). The menu expands upward from that top-trailing edge with
a 4dp gap and a staggered item reveal. Selecting an item invokes its
on_click and, by default, closes the menu.
Initialize a FabMenu.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
icon
|
IconLike
|
FAB icon shown while the menu is closed. |
required |
items
|
List[FabMenuItem]
|
The actions to display when the menu is open. |
required |
is_open
|
Optional[Observable[bool]]
|
Optional external |
None
|
auto_close
|
bool
|
When |
True
|
close_icon
|
Union['Symbol', str]
|
Icon the FAB morphs to while the menu is open.
Defaults to |
close
|
style
|
Optional[FabStyle]
|
FAB style preset selecting the colour family and size.
Defaults to :meth: |
None
|
key
|
Optional[str]
|
Stable widget identity for dev-bridge targeting and hot reload. |
None
|
Source code in src/nuiitivet/material/fab_menu.py
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 | |
is_open
property
¶
is_open: Observable[bool]
Observable that controls (and reflects) the menu's open state.
FabMenuItem
dataclass
¶
FabMenuItem(icon: IconLike, label: LabelLike, on_click: Optional[VoidCallback] = None, disabled: Union[bool, ObservableProtocol[bool]] = False)
Declarative spec for a single action inside a :class:FabMenu.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
icon
|
IconLike
|
Leading icon shown in the menu-item pill. |
required |
label
|
LabelLike
|
Text label rendered next to the icon. |
required |
on_click
|
Optional[VoidCallback]
|
Optional callback invoked when the item is selected. |
None
|
disabled
|
Union[bool, ObservableProtocol[bool]]
|
Whether the item is disabled (non-interactive). |
False
|
LoadingIntent
dataclass
¶
Intent for showing a loading indicator via MaterialOverlay.
This is a marker intent with no parameters. Visual properties should be configured via overlay_routes in MaterialApp.
Icon
¶
Icon(name: Symbol | str | ReadOnlyObservableProtocol[Symbol] | ReadOnlyObservableProtocol[str], *, size: SizingLike = 24, padding: Optional[Tuple[int, int, int, int] | Tuple[int, int] | int] = None, style: Optional['IconStyle'] = None, key: Optional[str] = None)
Bases: IconBase
Material Symbols icon widget (M3準拠).
Parameters: - name: Ligature name (e.g. "home", "menu") or Symbol - size: Icon visual size in pixels (default 24dp) - padding: Space around icon (M3: "space between UI elements") - style: IconStyle for customization (defaults to theme style)
Create a Material-like icon by ligature name.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
name
|
Symbol | str | ReadOnlyObservableProtocol[Symbol] | ReadOnlyObservableProtocol[str]
|
Ligature name such as "home", "menu", "search", a Symbol, or an Observable that yields either. |
required |
size
|
SizingLike
|
Logical pixel size of the icon (font size used for the glyph). |
24
|
padding
|
Optional[Tuple[int, int, int, int] | Tuple[int, int] | int]
|
Space around the icon (M3: "space between UI elements"). |
None
|
style
|
Optional['IconStyle']
|
IconStyle for customization (defaults to theme style). |
None
|
key
|
Optional[str]
|
Stable widget identity for dev-bridge targeting and hot reload. |
None
|
Source code in src/nuiitivet/material/icon.py
family
property
¶
Return the style-driven icon family.
The family is sourced from IconStyle.family (explicit style= or
theme-resolved style). If style resolution fails, this falls back to
"outlined".
preferred_size
¶
preferred_size(max_width: Optional[int] = None, max_height: Optional[int] = None) -> tuple[int, int]
Return preferred size including padding (M3準拠).
Source code in src/nuiitivet/material/icon.py
paint
¶
Paint icon with padding support (M3準拠).
Source code in src/nuiitivet/material/icon.py
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 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 | |
NavigationRail
¶
NavigationRail(children: Sequence[RailItem], *, index: Union[int, MutableObservableBase[int]] = 0, on_select: Optional[Callable[[int], None]] = None, expanded: Union[bool, MutableObservableBase[bool]] = False, show_menu_button: bool = True, width: Union[SizingLike, ReadOnlyObservableProtocol] = None, height: Union[SizingLike, ReadOnlyObservableProtocol] = None, padding: Union[int, Tuple[int, int], Tuple[int, int, int, int]] = 0, style: Optional[NavigationRailStyle] = None, key: Optional[str] = None)
Bases: InteractionHostMixin, Widget
Vertical navigation bar for desktop applications.
Material Design 3 component for persistent side navigation. Replaces NavigationDrawer for desktop/tablet layouts.
Display modes:
- Collapsed (expanded=False): Icon above label (vertical), 96px wide
- Expanded (expanded=True): Icon + label (horizontal), 220-360px wide
(the expanded width is set via the width argument; see __init__)
Both modes show labels. The active indicator (selection background) wraps: - Collapsed: Only the icon (56×32dp) - Expanded: Both icon and label
Users can toggle between modes with optional menu button.
For type-safe index, use IntEnum: class Section(IntEnum): HOME = 0 SEARCH = 1 NavigationRail(children=[...], index=Section.HOME)
Initialize NavigationRail.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
children
|
Sequence[RailItem]
|
The rail items to display. |
required |
index
|
Union[int, MutableObservableBase[int]]
|
The currently selected index. |
0
|
on_select
|
Optional[Callable[[int], None]]
|
Callback when an item is selected. |
None
|
expanded
|
Union[bool, MutableObservableBase[bool]]
|
Whether the rail is expanded. |
False
|
show_menu_button
|
bool
|
Whether to show the menu toggle button. |
True
|
width
|
Union[SizingLike, ReadOnlyObservableProtocol]
|
Expanded rail width. A fixed value (e.g. |
None
|
height
|
Union[SizingLike, ReadOnlyObservableProtocol]
|
Height specification. |
None
|
padding
|
Union[int, Tuple[int, int], Tuple[int, int, int, int]]
|
Padding specification. |
0
|
style
|
Optional[NavigationRailStyle]
|
Custom NavigationRailStyle. |
None
|
key
|
Optional[str]
|
Stable widget identity for dev-bridge targeting and hot reload. |
None
|
Source code in src/nuiitivet/material/navigation_rail.py
935 936 937 938 939 940 941 942 943 944 945 946 947 948 949 950 951 952 953 954 955 956 957 958 959 960 961 962 963 964 965 966 967 968 969 970 971 972 973 974 975 976 977 978 979 980 981 982 983 984 985 986 987 988 989 990 991 992 993 994 995 996 997 998 999 1000 1001 1002 1003 1004 1005 1006 1007 1008 1009 1010 1011 1012 1013 1014 1015 1016 1017 1018 1019 1020 1021 1022 1023 1024 1025 1026 1027 1028 1029 1030 1031 1032 1033 1034 1035 1036 1037 1038 1039 1040 1041 1042 1043 1044 1045 1046 1047 1048 1049 1050 1051 1052 1053 1054 1055 | |
on_key_event
¶
Rove the items with Up/Down, wrapping; Enter/Space acts on the focused item.
Only the vertical axis roves — a rail is always a column. Enter/Space are handled by the focused item itself, so they never reach here.
Source code in src/nuiitivet/material/navigation_rail.py
preferred_size
¶
preferred_size(max_width: Optional[int] = None, max_height: Optional[int] = None) -> Tuple[int, int]
Calculate preferred size for the navigation rail.
Source code in src/nuiitivet/material/navigation_rail.py
layout
¶
Layout the navigation rail and its child.
Source code in src/nuiitivet/material/navigation_rail.py
paint
¶
Paint the NavigationRail.
Source code in src/nuiitivet/material/navigation_rail.py
dispose
¶
Clean up subscriptions.
Source code in src/nuiitivet/material/navigation_rail.py
RailItem
¶
RailItem(icon: IconLike, label: LabelLike, *, small_badge: Optional[ReadOnlyObservableProtocol[bool]] = None, large_badge: Optional[ReadOnlyObservableProtocol[Optional[str]]] = None, style: Optional[NavigationRailStyle] = None, key: Optional[str] = None)
Bases: Widget
Navigation rail destination item.
A widget representing a single destination in NavigationRail. Displays an icon and optional label (when rail is expanded).
Initialize RailItem.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
icon
|
IconLike
|
The icon to display. May be a :class: |
required |
label
|
LabelLike
|
The label to display. May be a string or an observable string. |
required |
small_badge
|
Optional[ReadOnlyObservableProtocol[bool]]
|
Optional Observable controlling small dot badge visibility. |
None
|
large_badge
|
Optional[ReadOnlyObservableProtocol[Optional[str]]]
|
Optional Observable with badge text. |
None
|
style
|
Optional[NavigationRailStyle]
|
Optional style override for this item. |
None
|
key
|
Optional[str]
|
Stable widget identity for dev-bridge targeting and hot reload. |
None
|
Source code in src/nuiitivet/material/navigation_rail.py
Checkbox
¶
Checkbox(checked: bool | ObservableProtocol[bool] | ObservableProtocol[Optional[bool]] = False, *, on_toggle: Optional[Callable[[Optional[bool]], None]] = None, indeterminate: bool | ObservableProtocol[bool] = False, disabled: bool | ObservableProtocol[bool] = False, padding: Optional[Union[int, Tuple[int, int], Tuple[int, int, int, int]]] = None, style: Optional['CheckboxStyle'] = None, key: Optional[str] = None)
Bases: Toggleable, InteractiveWidget
A minimal Material-like Checkbox widget (M3).
Parameters: - checked: Checked state source (bool / Observable[bool] / Observable[Optional[bool]]) - on_toggle: Callback when toggled - padding: Space around the checkbox (M3: "space between UI elements") - indeterminate: Indeterminate flag (bool / Observable[bool]) - disabled: Disable interaction (bool / Observable[bool]) - style: CheckboxStyle for visual customization (defaults to theme style)
Source code in src/nuiitivet/material/selection_controls.py
preferred_size
¶
preferred_size(max_width: Optional[int] = None, max_height: Optional[int] = None) -> Tuple[int, int]
Return preferred size including padding (M3準拠).
Source code in src/nuiitivet/material/selection_controls.py
paint
¶
Paint checkbox with padding support (M3準拠).
Source code in src/nuiitivet/material/selection_controls.py
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 | |
draw_focus_indicator
¶
Draw the standard focus ring around the state-layer circle.
Source code in src/nuiitivet/material/selection_controls.py
RadioButton
¶
RadioButton(value: object | None, *, disabled: bool | ObservableProtocol[bool] = False, padding: Optional[Union[int, Tuple[int, int], Tuple[int, int, int, int]]] = None, style: Optional['RadioButtonStyle'] = None, key: Optional[str] = None)
Bases: Toggleable, InteractiveWidget
Material Design 3 RadioButton controlled by nearest RadioGroup.
Initialize RadioButton.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
value
|
object | None
|
Option value represented by this radio button. |
required |
disabled
|
bool | ObservableProtocol[bool]
|
Disable interaction when True. |
False
|
padding
|
Optional[Union[int, Tuple[int, int], Tuple[int, int, int, int]]]
|
Space around the touch target. |
None
|
style
|
Optional['RadioButtonStyle']
|
Style override. Uses theme style when omitted. |
None
|
key
|
Optional[str]
|
Stable widget identity for dev-bridge targeting and hot reload. |
None
|
Source code in src/nuiitivet/material/selection_controls.py
preferred_size
¶
preferred_size(max_width: Optional[int] = None, max_height: Optional[int] = None) -> Tuple[int, int]
Return preferred size including padding.
Source code in src/nuiitivet/material/selection_controls.py
paint
¶
Paint radio button with MD3-like visuals.
Source code in src/nuiitivet/material/selection_controls.py
812 813 814 815 816 817 818 819 820 821 822 823 824 825 826 827 828 829 830 831 832 833 834 835 836 837 838 839 840 841 842 843 844 845 846 847 848 849 850 851 852 853 854 855 856 857 858 859 860 861 862 863 864 865 866 867 868 869 870 871 872 873 874 875 876 877 878 879 880 881 882 883 884 885 886 887 888 889 890 891 892 893 894 895 896 897 898 899 900 901 902 | |
draw_focus_indicator
¶
Draw the standard focus ring around the state-layer circle.
Source code in src/nuiitivet/material/selection_controls.py
RadioGroup
¶
RadioGroup(child: Widget, *, value: object | ObservableProtocol[object | None] | None = None, on_change: Optional[Callable[[object | None], None]] = None, key: Optional[str] = None)
Bases: InteractionHostMixin, Container
Container that manages a single selected value for descendant RadioButtons.
The group is one focus traversal group (WAI-ARIA): a single Tab stop, entered at the selected radio, with the arrow keys roving between the radios. Roving also moves the selection ("selection follows focus"), so the arrows are how the keyboard picks an option; Space and Enter select the current one as well. The arrows wrap at the ends, and either axis roves — a radio group may be laid out as a Row or a Column, and the keys must work whichever it is.
Initialize RadioGroup.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
child
|
Widget
|
Root child subtree that contains radio options. |
required |
value
|
object | ObservableProtocol[object | None] | None
|
Selected value or external observable selected value. |
None
|
on_change
|
Optional[Callable[[object | None], None]]
|
Callback invoked when selection changes. |
None
|
key
|
Optional[str]
|
Stable widget identity for dev-bridge targeting and hot reload. |
None
|
Source code in src/nuiitivet/material/selection_controls.py
radios
¶
Return the radios the keyboard can rove, in tree order.
Disabled radios are left out: they are not selectable, so the arrow keys
skip over them rather than roving onto a dead option. A disabled radio has
no FocusNode either (see :class:~nuiitivet.widgets.clickable.Clickable),
which keeps this list and :meth:_radio_focus_nodes index-aligned.
Source code in src/nuiitivet/material/selection_controls.py
on_key_event
¶
Rove the radios with the arrow keys, moving the selection with the focus.
Source code in src/nuiitivet/material/selection_controls.py
Switch
¶
Switch(checked: bool | ObservableProtocol[bool] = False, *, on_change: Optional[Callable[[bool], None]] = None, disabled: bool | ObservableProtocol[bool] = False, padding: Optional[Union[int, Tuple[int, int], Tuple[int, int, int, int]]] = None, style: Optional['SwitchStyle'] = None, key: Optional[str] = None)
Bases: Toggleable, InteractiveWidget
Material Design 3 Switch widget.
Initialize Switch.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
checked
|
bool | ObservableProtocol[bool]
|
Checked state source (bool or observable bool). |
False
|
on_change
|
Optional[Callable[[bool], None]]
|
Callback invoked when checked state changes. |
None
|
disabled
|
bool | ObservableProtocol[bool]
|
Disable interaction when True. |
False
|
padding
|
Optional[Union[int, Tuple[int, int], Tuple[int, int, int, int]]]
|
Space around the switch. |
None
|
style
|
Optional['SwitchStyle']
|
Style override. Uses theme style when omitted. |
None
|
key
|
Optional[str]
|
Stable widget identity for dev-bridge targeting and hot reload. |
None
|
Source code in src/nuiitivet/material/selection_controls.py
preferred_size
¶
preferred_size(max_width: Optional[int] = None, max_height: Optional[int] = None) -> Tuple[int, int]
Return preferred size including padding.
Source code in src/nuiitivet/material/selection_controls.py
paint_outsets
¶
Extend the overflow allowance for the track's sideways overhang.
The track is wider than the touch target and the focus ring sits outside the track, so the base ring-only allowance would clip the ring's left and right edges.
Source code in src/nuiitivet/material/selection_controls.py
paint
¶
Paint switch with animated thumb and track.
Source code in src/nuiitivet/material/selection_controls.py
1063 1064 1065 1066 1067 1068 1069 1070 1071 1072 1073 1074 1075 1076 1077 1078 1079 1080 1081 1082 1083 1084 1085 1086 1087 1088 1089 1090 1091 1092 1093 1094 1095 1096 1097 1098 1099 1100 1101 1102 1103 1104 1105 1106 1107 1108 1109 1110 1111 1112 1113 1114 1115 1116 1117 1118 1119 1120 1121 1122 1123 1124 1125 1126 1127 1128 1129 1130 1131 1132 1133 1134 1135 1136 1137 1138 1139 1140 1141 1142 1143 1144 1145 1146 1147 1148 1149 1150 1151 1152 1153 1154 1155 1156 1157 1158 1159 1160 1161 1162 1163 1164 1165 1166 1167 1168 1169 1170 1171 1172 1173 1174 1175 1176 1177 1178 1179 1180 1181 1182 1183 | |
draw_focus_indicator
¶
Draw the standard focus ring around the track.
Unlike Checkbox/RadioButton, the MD3 switch ring hugs the track outline rather than the thumb's state-layer circle, so it is a pill shape that stays put as the thumb moves.
Source code in src/nuiitivet/material/selection_controls.py
HorizontalCenteredSlider
¶
HorizontalCenteredSlider(value: float | ObservableProtocol[float] = 0.0, *, on_change: Optional[Callable[[float], None]] = None, min_value: float = -1.0, max_value: float = 1.0, stops: Optional[int] = None, show_value_indicator: bool = False, disabled: bool | ObservableProtocol[bool] = False, width: SizingLike = 'wt', padding: Optional[Tuple[int, int] | Tuple[int, int, int, int] | int] = None, style: Optional['SliderStyle'] = None, key: Optional[str] = None)
Bases: _CenteredSlider
Material Design 3 horizontal centered slider. Sized with width.
Initialize HorizontalCenteredSlider.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
value
|
float | ObservableProtocol[float]
|
Current slider value or observable value. |
0.0
|
on_change
|
Optional[Callable[[float], None]]
|
Callback invoked when value changes. |
None
|
min_value
|
float
|
Minimum value (default: -1.0). |
-1.0
|
max_value
|
float
|
Maximum value (default: 1.0). |
1.0
|
stops
|
Optional[int]
|
Discrete stop count. |
None
|
show_value_indicator
|
bool
|
Whether to show value indicator during drag. |
False
|
disabled
|
bool | ObservableProtocol[bool]
|
Disabled state. |
False
|
width
|
SizingLike
|
Main-axis (width) sizing. |
'wt'
|
padding
|
Optional[Tuple[int, int] | Tuple[int, int, int, int] | int]
|
Slider padding. |
None
|
style
|
Optional['SliderStyle']
|
Optional SliderStyle override. |
None
|
key
|
Optional[str]
|
Stable widget identity for dev-bridge targeting and hot reload. |
None
|
Source code in src/nuiitivet/material/slider.py
HorizontalRangeSlider
¶
HorizontalRangeSlider(value_start: float | ObservableProtocol[float] = 0.0, value_end: float | ObservableProtocol[float] = 1.0, *, on_change: Optional[Callable[[Tuple[float, float]], None]] = None, min_value: float = 0.0, max_value: float = 1.0, stops: Optional[int] = None, show_value_indicator: bool = False, disabled: bool | ObservableProtocol[bool] = False, width: SizingLike = 'wt', padding: Optional[Tuple[int, int] | Tuple[int, int, int, int] | int] = None, style: Optional['SliderStyle'] = None, key: Optional[str] = None)
Bases: _RangeSlider
Material Design 3 horizontal range slider. Sized with width.
Initialize HorizontalRangeSlider.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
value_start
|
float | ObservableProtocol[float]
|
Start value or observable value. |
0.0
|
value_end
|
float | ObservableProtocol[float]
|
End value or observable value. |
1.0
|
on_change
|
Optional[Callable[[Tuple[float, float]], None]]
|
Callback invoked when range changes. |
None
|
min_value
|
float
|
Minimum value. |
0.0
|
max_value
|
float
|
Maximum value. |
1.0
|
stops
|
Optional[int]
|
Discrete stop count. |
None
|
show_value_indicator
|
bool
|
Whether to show value indicator during drag. |
False
|
disabled
|
bool | ObservableProtocol[bool]
|
Disabled state. |
False
|
width
|
SizingLike
|
Main-axis (width) sizing. |
'wt'
|
padding
|
Optional[Tuple[int, int] | Tuple[int, int, int, int] | int]
|
Slider padding. |
None
|
style
|
Optional['SliderStyle']
|
Optional SliderStyle override. |
None
|
key
|
Optional[str]
|
Stable widget identity for dev-bridge targeting and hot reload. |
None
|
Source code in src/nuiitivet/material/slider.py
HorizontalSlider
¶
HorizontalSlider(value: float | ObservableProtocol[float] = 0.0, *, on_change: Optional[Callable[[float], None]] = None, min_value: float = 0.0, max_value: float = 1.0, stops: Optional[int] = None, show_value_indicator: bool = False, disabled: bool | ObservableProtocol[bool] = False, width: SizingLike = 'wt', padding: Optional[Tuple[int, int] | Tuple[int, int, int, int] | int] = None, style: Optional['SliderStyle'] = None, key: Optional[str] = None)
Bases: _Slider
Material Design 3 horizontal slider. Sized with width.
Initialize HorizontalSlider.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
value
|
float | ObservableProtocol[float]
|
Current slider value or observable value. |
0.0
|
on_change
|
Optional[Callable[[float], None]]
|
Callback invoked when value changes. |
None
|
min_value
|
float
|
Minimum value. |
0.0
|
max_value
|
float
|
Maximum value. |
1.0
|
stops
|
Optional[int]
|
Discrete stop count. |
None
|
show_value_indicator
|
bool
|
Whether to show value indicator during drag. |
False
|
disabled
|
bool | ObservableProtocol[bool]
|
Disabled state. |
False
|
width
|
SizingLike
|
Main-axis (width) sizing. |
'wt'
|
padding
|
Optional[Tuple[int, int] | Tuple[int, int, int, int] | int]
|
Slider padding. |
None
|
style
|
Optional['SliderStyle']
|
Optional SliderStyle override. |
None
|
key
|
Optional[str]
|
Stable widget identity for dev-bridge targeting and hot reload. |
None
|
Source code in src/nuiitivet/material/slider.py
VerticalCenteredSlider
¶
VerticalCenteredSlider(value: float | ObservableProtocol[float] = 0.0, *, on_change: Optional[Callable[[float], None]] = None, min_value: float = -1.0, max_value: float = 1.0, stops: Optional[int] = None, show_value_indicator: bool = False, disabled: bool | ObservableProtocol[bool] = False, height: SizingLike = 'wt', padding: Optional[Tuple[int, int] | Tuple[int, int, int, int] | int] = None, style: Optional['SliderStyle'] = None, key: Optional[str] = None)
Bases: _CenteredSlider
Material Design 3 vertical centered slider. Sized with height.
Initialize VerticalCenteredSlider.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
value
|
float | ObservableProtocol[float]
|
Current slider value or observable value. |
0.0
|
on_change
|
Optional[Callable[[float], None]]
|
Callback invoked when value changes. |
None
|
min_value
|
float
|
Minimum value (default: -1.0). |
-1.0
|
max_value
|
float
|
Maximum value (default: 1.0). |
1.0
|
stops
|
Optional[int]
|
Discrete stop count. |
None
|
show_value_indicator
|
bool
|
Whether to show value indicator during drag. |
False
|
disabled
|
bool | ObservableProtocol[bool]
|
Disabled state. |
False
|
height
|
SizingLike
|
Main-axis (height) sizing. |
'wt'
|
padding
|
Optional[Tuple[int, int] | Tuple[int, int, int, int] | int]
|
Slider padding. |
None
|
style
|
Optional['SliderStyle']
|
Optional SliderStyle override. |
None
|
key
|
Optional[str]
|
Stable widget identity for dev-bridge targeting and hot reload. |
None
|
Source code in src/nuiitivet/material/slider.py
VerticalRangeSlider
¶
VerticalRangeSlider(value_start: float | ObservableProtocol[float] = 0.0, value_end: float | ObservableProtocol[float] = 1.0, *, on_change: Optional[Callable[[Tuple[float, float]], None]] = None, min_value: float = 0.0, max_value: float = 1.0, stops: Optional[int] = None, show_value_indicator: bool = False, disabled: bool | ObservableProtocol[bool] = False, height: SizingLike = 'wt', padding: Optional[Tuple[int, int] | Tuple[int, int, int, int] | int] = None, style: Optional['SliderStyle'] = None, key: Optional[str] = None)
Bases: _RangeSlider
Material Design 3 vertical range slider. Sized with height.
Initialize VerticalRangeSlider.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
value_start
|
float | ObservableProtocol[float]
|
Start value or observable value. |
0.0
|
value_end
|
float | ObservableProtocol[float]
|
End value or observable value. |
1.0
|
on_change
|
Optional[Callable[[Tuple[float, float]], None]]
|
Callback invoked when range changes. |
None
|
min_value
|
float
|
Minimum value. |
0.0
|
max_value
|
float
|
Maximum value. |
1.0
|
stops
|
Optional[int]
|
Discrete stop count. |
None
|
show_value_indicator
|
bool
|
Whether to show value indicator during drag. |
False
|
disabled
|
bool | ObservableProtocol[bool]
|
Disabled state. |
False
|
height
|
SizingLike
|
Main-axis (height) sizing. |
'wt'
|
padding
|
Optional[Tuple[int, int] | Tuple[int, int, int, int] | int]
|
Slider padding. |
None
|
style
|
Optional['SliderStyle']
|
Optional SliderStyle override. |
None
|
key
|
Optional[str]
|
Stable widget identity for dev-bridge targeting and hot reload. |
None
|
Source code in src/nuiitivet/material/slider.py
VerticalSlider
¶
VerticalSlider(value: float | ObservableProtocol[float] = 0.0, *, on_change: Optional[Callable[[float], None]] = None, min_value: float = 0.0, max_value: float = 1.0, stops: Optional[int] = None, show_value_indicator: bool = False, disabled: bool | ObservableProtocol[bool] = False, height: SizingLike = 'wt', padding: Optional[Tuple[int, int] | Tuple[int, int, int, int] | int] = None, style: Optional['SliderStyle'] = None, key: Optional[str] = None)
Bases: _Slider
Material Design 3 vertical slider. Sized with height.
Initialize VerticalSlider.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
value
|
float | ObservableProtocol[float]
|
Current slider value or observable value. |
0.0
|
on_change
|
Optional[Callable[[float], None]]
|
Callback invoked when value changes. |
None
|
min_value
|
float
|
Minimum value. |
0.0
|
max_value
|
float
|
Maximum value. |
1.0
|
stops
|
Optional[int]
|
Discrete stop count. |
None
|
show_value_indicator
|
bool
|
Whether to show value indicator during drag. |
False
|
disabled
|
bool | ObservableProtocol[bool]
|
Disabled state. |
False
|
height
|
SizingLike
|
Main-axis (height) sizing. |
'wt'
|
padding
|
Optional[Tuple[int, int] | Tuple[int, int, int, int] | int]
|
Slider padding. |
None
|
style
|
Optional['SliderStyle']
|
Optional SliderStyle override. |
None
|
key
|
Optional[str]
|
Stable widget identity for dev-bridge targeting and hot reload. |
None
|
Source code in src/nuiitivet/material/slider.py
Symbols
¶
Material Symbols constants (auto-generated).
TextField
¶
TextField(value: Union[str, ReadOnlyObservableProtocol[str]] = '', *, on_change: Optional[Callable[[str], None]] = None, on_submit: Optional[Callable[[str], None]] = None, on_focus_change: Optional[FocusChangeCallback] = None, input_filter: Optional[InputFilterLike] = None, label: str | ReadOnlyObservableProtocol[str] | None = None, leading_icon: Symbol | str | ReadOnlyObservableProtocol[Symbol] | ReadOnlyObservableProtocol[str] | None = None, on_tap_leading_icon: Optional[Callable[[], None]] = None, trailing_icon: Symbol | str | ReadOnlyObservableProtocol[Symbol] | ReadOnlyObservableProtocol[str] | None = None, on_tap_trailing_icon: Optional[Callable[[], None]] = None, obscure_text: bool = False, supporting_text: str | ReadOnlyObservableProtocol[str | None] | None = None, is_error: bool | ReadOnlyObservableProtocol[bool] = False, disabled: bool | ReadOnlyObservableProtocol[bool] = False, width: SizingLike = 200, padding: Union[int, Tuple[int, int], Tuple[int, int, int, int]] = 0, style: Optional[TextFieldStyle] = None, key: Optional[str] = None)
Bases: InteractiveWidget
A text input widget base class.
Note
An observable passed as value holds the field's value, the same as
for every other input widget: it is displayed, and edits are written
back to it. A read-only observable (.map(...), a computed value)
has nowhere to write, so it displays only -- pair it with
disabled=True to make that visible to the user.
Parameters:
- value: Initial text (str), or the observable that holds the field's value
- on_change: Callback when value changes
- on_submit: Callback invoked with the confirmed value when the user presses
Enter in the field or moves focus away from it, and only when the text
changed since the last commit
- input_filter: Rule applied to text as the user types it -- see
:mod:nuiitivet.widgets.input_filter. It governs what is typeable;
whether a finished value is acceptable belongs in is_error /
supporting_text, and reshaping a finished value belongs in
on_submit
- label: Floating label text (supports Observable)
- leading_icon: Icon source (Symbol/str or Observable of them)
- on_tap_leading_icon: Callback invoked when the leading icon is tapped.
Supplying it upgrades the icon to a standard IconButton with hover /
focus / pressed state layers; a decorative icon (no callback) renders
as a plain, feedback-free glyph.
- trailing_icon: Icon source (Symbol/str or Observable of them)
- on_tap_trailing_icon: Callback invoked when the trailing icon is tapped
(see on_tap_leading_icon for the interactive-icon behavior)
- obscure_text: Whether to mask text display (password-style)
- supporting_text: Supporting text to display below the field (supports Observable)
- is_error: Whether the field is in error state (supports Observable)
- style: Custom style configuration
- width: Explicit width sizing
- height: Explicit height sizing
- padding: Space around the text field
- disabled: Disable interaction (supports Observable)
Initialize TextField.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
value
|
Union[str, ReadOnlyObservableProtocol[str]]
|
Initial text, or the observable holding the field's value. Edits are written back to a writable observable. |
''
|
on_change
|
Optional[Callable[[str], None]]
|
Callback invoked with the text as it changes, for a side effect of the change. The observable bound to value is already updated without it, and carries the same signal: the two are announced together, so neither reports the provisional text of an unconfirmed IME composition. |
None
|
on_submit
|
Optional[Callable[[str], None]]
|
Callback invoked with the text when the user presses Enter. Fires on every press, including a repeat on an unchanged value, and never on focus loss -- it reports a request to act, not a value settling. To react to the user leaving the field, use on_focus_change. |
None
|
on_focus_change
|
Optional[FocusChangeCallback]
|
Callback invoked as focus arrives and leaves,
with |
None
|
input_filter
|
Optional[InputFilterLike]
|
Rule applied to text as the user types it. |
None
|
label
|
str | ReadOnlyObservableProtocol[str] | None
|
Floating label text. |
None
|
leading_icon
|
Symbol | str | ReadOnlyObservableProtocol[Symbol] | ReadOnlyObservableProtocol[str] | None
|
Icon displayed before the text. |
None
|
on_tap_leading_icon
|
Optional[Callable[[], None]]
|
Callback invoked when the leading icon is tapped. |
None
|
trailing_icon
|
Symbol | str | ReadOnlyObservableProtocol[Symbol] | ReadOnlyObservableProtocol[str] | None
|
Icon displayed after the text. |
None
|
on_tap_trailing_icon
|
Optional[Callable[[], None]]
|
Callback invoked when the trailing icon is tapped. |
None
|
obscure_text
|
bool
|
Whether to mask text display (password-style). |
False
|
supporting_text
|
str | ReadOnlyObservableProtocol[str | None] | None
|
Supporting text displayed below the field. |
None
|
is_error
|
bool | ReadOnlyObservableProtocol[bool]
|
Whether the field is in its error state. This is a visual axis of the whole field -- outline, label, cursor and supporting text all change -- and is independent of what supporting_text says, so a field can be flagged without a message and carry a message without being flagged. |
False
|
disabled
|
bool | ReadOnlyObservableProtocol[bool]
|
Whether the text field is disabled. |
False
|
width
|
SizingLike
|
Width specification. |
200
|
padding
|
Union[int, Tuple[int, int], Tuple[int, int, int, int]]
|
Padding around the text field. |
0
|
style
|
Optional[TextFieldStyle]
|
Custom style configuration. |
None
|
key
|
Optional[str]
|
Stable widget identity for dev-bridge targeting and hot reload. |
None
|
Source code in src/nuiitivet/material/text_fields.py
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 | |
should_show_focus_ring
property
¶
Show the focus ring only when focus arrived via keyboard navigation.
The actual focus subject is self._editable; the host TextField
does not own a FocusNode (see focusable=False in init).
EditableText exposes is_focus_from_pointer so that, per
MD3 spec, the ring is suppressed for clicks.
preferred_size
¶
preferred_size(max_width: Optional[int] = None, max_height: Optional[int] = None) -> Tuple[int, int]
Return the preferred (width, height) for this TextField.
Source code in src/nuiitivet/material/text_fields.py
focus
¶
Programmatically focus the TextField (keyboard-style focus).
Delegates to the inner EditableText. This path does NOT mark the
focus as pointer-driven, so the focus ring will be shown — use
this for keyboard / API-initiated focus only. Pointer presses go
through _handle_press which calls
EditableText.request_focus_from_pointer to suppress the ring
per MD3 spec.
Source code in src/nuiitivet/material/text_fields.py
TextFieldStyle
dataclass
¶
TextFieldStyle(mode: TextFieldMode = 'filled', container_color: ColorSpec = SURFACE_CONTAINER_HIGHEST, indicator_color: ColorSpec = ON_SURFACE_VARIANT, indicator_width: float = 1.0, focused_indicator_color: ColorSpec = PRIMARY, focused_indicator_width: float = 2.0, error_indicator_color: ColorSpec = ERROR, text_color: ColorSpec = ON_SURFACE, label_color: ColorSpec = ON_SURFACE_VARIANT, focused_label_color: ColorSpec = PRIMARY, error_label_color: ColorSpec = ERROR, supporting_text_color: ColorSpec = ON_SURFACE_VARIANT, error_supporting_text_color: ColorSpec = ERROR, cursor_color: ColorSpec = PRIMARY, error_cursor_color: ColorSpec = ERROR, selection_color: ColorSpec = PRIMARY_CONTAINER, border_radius: float = 4.0, content_padding: Tuple[int, int, int, int] = (16, 16, 16, 16))
Style configuration for :class:TextField (M3-compliant).
The visual variant is captured by the :attr:mode field: "filled"
draws an underline indicator with top-rounded container corners while
"outlined" draws a full rectangular border. Use the :meth:filled
and :meth:outlined factory methods to obtain the standard presets.
copy_with
¶
filled
classmethod
¶
Default M3 Filled TextField style.
Source code in src/nuiitivet/material/styles/text_field_style.py
outlined
classmethod
¶
Default M3 Outlined TextField style.
Source code in src/nuiitivet/material/styles/text_field_style.py
from_theme
classmethod
¶
Resolve the default :class:TextFieldStyle for the given theme.
Returns the theme's filled text field style if a Material theme
extension is present, otherwise a fresh :meth:filled preset.
Source code in src/nuiitivet/material/styles/text_field_style.py
DockedSearchBar
¶
DockedSearchBar(value: Union[str, ReadOnlyObservableProtocol[str]] = '', *, content: Widget, is_open: Optional[Observable[bool]] = None, close_on_enter: bool = True, placeholder: str | None = None, leading_icon: IconLike = 'search', on_tap_leading_icon: Optional[Callable[[], None]] = None, trailing_icon: IconLike = None, on_tap_trailing_icon: Optional[Callable[[], None]] = None, on_change: Optional[Callable[[str], None]] = None, on_submit: Optional[Callable[[str], None]] = None, on_focus_change: Optional[FocusChangeCallback] = None, input_filter: Optional[InputFilterLike] = None, width: SizingLike = None, style: Optional[DockedSearchBarStyle] = None, key: Optional[str] = None)
Bases: ComposableWidget
Material Design 3 docked search (contained variant).
A :class:SearchBar with a container anchored 2dp below it, holding
whatever the query currently calls for — recent searches, suggestions,
results, a spinner, "no matches". There is one slot, content, and the
application swaps what is inside it from its own observables; the widget
only shows and hides the container. That also means the query pipeline
keeps running while the container is closed, so gate it yourself if that
matters.
When the container opens and closes. The state is a single observable, writable at any time by the application, that this widget drives from these triggers:
==================================== ================================== Trigger Effect ==================================== ================================== Focus gained Open — including on an empty query, which is where MD3 shows recent searches A tap on the bar Open — focus cannot re-fire when the bar already holds it, so the tap itself is a trigger User edits the text Open, even if it was just closed Enter Close when close_on_enter Escape Close, leaving the bar focused — typing reopens. With nothing to close, Escape is not claimed Focus lost, or a tap outside Close. The bar is not outside: a tap there moves the caret and the container stays up ==================================== ==================================
The edit trigger is what makes "Enter closes the panel, results render on
the page" work: focus never changed, so without it the panel could not
come back. It counts user edits only — assigning to value, or a
write to the bound observable, does not reopen the container, so filling
the bar in after a pick stays closed. The tap trigger covers the pointer
half of the same gap.
Escape rides the window's back-event path, which closes the topmost overlay entry — this container, when it is open — without moving focus. When the container is closed the path declines the key, so an enclosing handler (a dialog, the navigator) still sees it.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
value
|
Union[str, ReadOnlyObservableProtocol[str]]
|
Initial query text, or the observable holding it. |
''
|
content
|
Widget
|
Widget rendered inside the docked container. |
required |
is_open
|
Optional[Observable[bool]]
|
Observable holding whether the container is open. Pass one to
drive or observe it; when omitted an internal one is created and
exposed as :attr: |
None
|
close_on_enter
|
bool
|
Whether Enter closes the container. The default suits
a page that renders its own results; pass |
True
|
placeholder
|
str | None
|
Supporting text shown inside the bar while it is empty. |
None
|
leading_icon
|
IconLike
|
Icon source for the leading slot. |
'search'
|
on_tap_leading_icon
|
Optional[Callable[[], None]]
|
Makes the leading icon a tappable icon button. |
None
|
trailing_icon
|
IconLike
|
Icon source for the trailing slot. |
None
|
on_tap_trailing_icon
|
Optional[Callable[[], None]]
|
Makes the trailing icon a tappable icon button. |
None
|
on_change
|
Optional[Callable[[str], None]]
|
Callback invoked with the query as it changes, for a side effect of the change. The observable bound to value carries the same signal without it. |
None
|
on_submit
|
Optional[Callable[[str], None]]
|
Callback invoked with the query when Enter is pressed. Fires on every press, including a repeat on an unchanged query, and never on focus loss. |
None
|
on_focus_change
|
Optional[FocusChangeCallback]
|
Callback invoked as focus arrives and leaves, with
|
None
|
input_filter
|
Optional[InputFilterLike]
|
Rule applied to text as the user types it. |
None
|
width
|
SizingLike
|
Sizing for the box — see :class: |
None
|
style
|
Optional[DockedSearchBarStyle]
|
Custom style configuration. |
None
|
Source code in src/nuiitivet/material/search.py
is_open
property
¶
is_open: Observable[bool]
Observable holding whether the docked container is open.
Writable: setting it opens or closes the container directly. The widget writes it too, on the triggers listed in the class docstring.
focus
¶
build
¶
build() -> Widget
Return the pane, with a popup anchored to the inset bar.
The popup's offset is constant: OverlayPosition.anchored
re-resolves the anchor rect on every layout pass, so anchoring to the
bar (rather than to the pane) tracks the margin animation for free.
flip=False keeps the container below the bar even when the window
is too short for it: it overflows downwards rather than opening
upwards. Opening above would also be correct MD3 — turn it on if that
is wanted. Either way the bar is never covered, because popup only
ever shifts content along the cross axis.
Source code in src/nuiitivet/material/search.py
SearchBar
¶
SearchBar(value: Union[str, ReadOnlyObservableProtocol[str]] = '', *, placeholder: str | None = None, leading_icon: IconLike = 'search', on_tap_leading_icon: Optional[Callable[[], None]] = None, trailing_icon: IconLike = None, on_tap_trailing_icon: Optional[Callable[[], None]] = None, on_change: Optional[Callable[[str], None]] = None, on_submit: Optional[Callable[[str], None]] = None, on_focus_change: Optional[FocusChangeCallback] = None, input_filter: Optional[InputFilterLike] = None, width: SizingLike = None, style: Optional[SearchBarStyle] = None, key: Optional[str] = None)
Bases: ComposableWidget
Material Design 3 search bar (contained variant).
The bar is drawn inset inside the box this widget is given: 24dp on each
side, animating to 12dp while focused. width therefore names the
box, not the bar — which keeps the widget's footprint stable when it is
focused, instead of reflowing its siblings.
There is no full-screen search widget. To build one, lay out your own
screen and place a SearchBar in it; the bar brings its own margin
animation with it.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
value
|
Union[str, ReadOnlyObservableProtocol[str]]
|
Initial query text, or the observable holding it. Edits are
written back to a writable observable, exactly as for |
''
|
placeholder
|
str | None
|
Supporting text shown inside the bar while it is empty. |
None
|
leading_icon
|
IconLike
|
Icon source (Symbol/str, or an Observable of them). |
'search'
|
on_tap_leading_icon
|
Optional[Callable[[], None]]
|
Makes the leading icon a tappable icon button. |
None
|
trailing_icon
|
IconLike
|
Icon source for the trailing slot. |
None
|
on_tap_trailing_icon
|
Optional[Callable[[], None]]
|
Makes the trailing icon a tappable icon button. The slot is generic — clearing the query is one use of it, not a built-in behaviour. |
None
|
on_change
|
Optional[Callable[[str], None]]
|
Callback invoked with the query as it changes, for a side effect of the change. The observable bound to value carries the same signal without it. |
None
|
on_submit
|
Optional[Callable[[str], None]]
|
Callback invoked with the query when Enter is pressed. Fires on every press, including a repeat on an unchanged query, and never on focus loss. |
None
|
on_focus_change
|
Optional[FocusChangeCallback]
|
Callback invoked as focus arrives and leaves, with
|
None
|
input_filter
|
Optional[InputFilterLike]
|
Rule applied to text as the user types it. |
None
|
width
|
SizingLike
|
Sizing for the box, not for the bar drawn inside it. The bar
is the box minus the margins, so |
None
|
style
|
Optional[SearchBarStyle]
|
Custom style configuration. |
None
|
Source code in src/nuiitivet/material/search.py
focus
¶
DockedSearchBarStyle
dataclass
¶
DockedSearchBarStyle(bar: SearchBarStyle = SearchBarStyle(), container_color: ColorSpec = SURFACE_CONTAINER_HIGH, corner_radius: float = 12.0, gap: float = 2.0, min_height: float = 240.0, max_height_ratio: float = 2.0 / 3.0)
Style configuration for :class:~nuiitivet.material.search.DockedSearchBar.
MD3 reference: md.comp.search-view.contained.docked.*.
copy_with
¶
SearchBarStyle
dataclass
¶
SearchBarStyle(container_color: ColorSpec = SURFACE_CONTAINER_HIGH, container_height: float = 56.0, margin: float = 24.0, focused_margin: float = 12.0, min_width: float = 360.0, max_width: float = 720.0, input_text_color: ColorSpec = ON_SURFACE, supporting_text_color: ColorSpec = ON_SURFACE_VARIANT, font_size: int = 16, leading_icon_color: ColorSpec = ON_SURFACE, trailing_icon_color: ColorSpec = ON_SURFACE_VARIANT, icon_size: int = 24, cursor_color: ColorSpec = PRIMARY, selection_color: ColorSpec = PRIMARY_CONTAINER, state_layer_color: ColorSpec = ON_SURFACE, focus_indicator_color: ColorSpec = SECONDARY, leading_space: float = 4.0, trailing_space: float = 4.0, icon_label_gap: float = 4.0)
Style configuration for :class:~nuiitivet.material.search.SearchBar.
MD3 reference: md.comp.search-bar.*, contained rows only.
copy_with
¶
from_theme
classmethod
¶
Resolve the default :class:SearchBarStyle for the given theme.
The defaults are already theme roles rather than literal colours, so this returns the preset unless a Material theme extension overrides it.
Source code in src/nuiitivet/material/styles/search_bar_style.py
TextStyle
dataclass
¶
Immutable visual style for Material Text widgets (M3-compliant).
Use copy_with() to create style variants.
Material Design 3 Text specifications: - Default color: ON_SURFACE
Typography comes from the widget's type_scale and alignment from the
widget itself, so neither lives here.
IconStyle
dataclass
¶
IconStyle(default_size: int = 24, padding: int = 0, family: str = 'outlined', color: ColorSpec = ON_SURFACE, font_family_priority: Tuple[str, ...] = ('Material Symbols Outlined', 'Material Symbols Rounded', 'Material Symbols Sharp', 'Material Icons'), custom_font_family: Optional[str] = None, style_to_family: dict[str, str] = None)
Immutable style for Icon widgets (M3準拠).
Material Design 3 Icon specifications: - Default size: 24dp - Default color: ON_SURFACE - Font family priority: Material Symbols → Material Icons
DividerStyle
dataclass
¶
DividerStyle(color: ColorSpec = OUTLINE_VARIANT, thickness: int = 1, inset_left: int = 0, inset_right: int = 0)
Immutable style for the Divider widget.
Attributes:
| Name | Type | Description |
|---|---|---|
color |
ColorSpec
|
Line color. Defaults to the M3 Outline Variant color role. |
thickness |
int
|
Line thickness in pixels. Defaults to |
inset_left |
int
|
Left-side inset in pixels. Defaults to |
inset_right |
int
|
Right-side inset in pixels. Defaults to |
copy_with
¶
Return a copy of this style with the given fields overridden.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
**changes
|
Any
|
Fields to override. |
{}
|
Returns:
| Type | Description |
|---|---|
'DividerStyle'
|
A new :class: |
Source code in src/nuiitivet/material/styles/divider_style.py
ToolbarStyle
dataclass
¶
ToolbarStyle(color_scheme: ToolbarColorScheme = 'standard', background: ColorSpec = SURFACE_CONTAINER_HIGHEST, foreground: ColorSpec = ON_SURFACE, container_height: int = 64, content_padding: tuple[int, int, int, int] = (16, 0, 16, 0), item_gap: int = 8, corner_radius: int = 0, border_color: Optional[ColorSpec] = None, border_width: float = 0.0, elevation: float = 0.0)
Immutable style for Material toolbar widgets.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
color_scheme
|
ToolbarColorScheme
|
Toolbar color scheme variant. |
'standard'
|
background
|
ColorSpec
|
Toolbar container background color. |
SURFACE_CONTAINER_HIGHEST
|
foreground
|
ColorSpec
|
Recommended foreground color for icon actions. |
ON_SURFACE
|
container_height
|
int
|
Visual container height in pixels. |
64
|
content_padding
|
tuple[int, int, int, int]
|
Internal content insets. |
(16, 0, 16, 0)
|
item_gap
|
int
|
Gap between action buttons. |
8
|
corner_radius
|
int
|
Container corner radius in pixels. |
0
|
border_color
|
Optional[ColorSpec]
|
Optional border color. |
None
|
border_width
|
float
|
Border width in pixels. |
0.0
|
elevation
|
float
|
Elevation level for shadow rendering. |
0.0
|
copy_with
¶
standard
classmethod
¶
Return the standard toolbar style.
Source code in src/nuiitivet/material/styles/toolbar_style.py
vibrant
classmethod
¶
Return the vibrant toolbar style.
Source code in src/nuiitivet/material/styles/toolbar_style.py
preset
classmethod
¶
Return the framework preset for variant, ignoring any theme.
This is what a toolbar renders with before it is mounted, and what
:meth:from_theme falls back to when no Material theme is installed.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
variant
|
ToolbarColorScheme
|
One of |
'standard'
|
Returns:
| Type | Description |
|---|---|
'ToolbarStyle'
|
The variant preset style. |
Source code in src/nuiitivet/material/styles/toolbar_style.py
from_theme
classmethod
¶
Resolve the toolbar style from theme.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
theme
|
'Theme'
|
Theme instance. |
required |
variant
|
ToolbarColorScheme
|
One of |
'standard'
|
Returns:
| Type | Description |
|---|---|
'ToolbarStyle'
|
Resolved toolbar style. |
Source code in src/nuiitivet/material/styles/toolbar_style.py
CircularProgressIndicatorStyle
dataclass
¶
CircularProgressIndicatorStyle(active_indicator_color: ColorSpec = PRIMARY, track_color: ColorSpec = SECONDARY_CONTAINER, stop_indicator_color: ColorSpec = PRIMARY, disabled_active_alpha: float = 0.38, disabled_track_alpha: float = 0.12, size: float = 40.0, with_wave_size: float = 48.0, track_thickness: float = 4.0, track_active_space: float = 4.0, wave_amplitude: float = 1.6, wave_wavelength: float = 15.0, motion: Motion = EXPRESSIVE_DEFAULT_EFFECTS)
Bases: ProgressIndicatorStyle
Circular progress indicator geometry and motion tokens.
default
classmethod
¶
flat
classmethod
¶
Create a flat circular progress style preset.
from_theme
classmethod
¶
Get circular progress style from theme.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
theme
|
'Theme'
|
Theme to load style from. |
required |
variant
|
str
|
Variant name ("default" or "flat"). |
'default'
|
Returns:
| Type | Description |
|---|---|
'CircularProgressIndicatorStyle'
|
CircularProgressIndicatorStyle resolved from theme or fallback preset. |
Source code in src/nuiitivet/material/styles/progress_indicator_style.py
LinearProgressIndicatorStyle
dataclass
¶
LinearProgressIndicatorStyle(active_indicator_color: ColorSpec = PRIMARY, track_color: ColorSpec = SECONDARY_CONTAINER, stop_indicator_color: ColorSpec = PRIMARY, disabled_active_alpha: float = 0.38, disabled_track_alpha: float = 0.12, track_thickness: float = 4.0, with_wave_height: float = 10.0, stop_indicator_size: float = 4.0, track_active_space: float = 4.0, stop_indicator_trailing_space: float = 0.0, wave_amplitude: float = 3.0, wave_wavelength: float = 40.0, indeterminate_wave_wavelength: float = 20.0, motion: Motion = EXPRESSIVE_DEFAULT_EFFECTS)
Bases: ProgressIndicatorStyle
Linear progress indicator geometry and motion tokens.
default
classmethod
¶
flat
classmethod
¶
Create a flat linear progress style preset.
from_theme
classmethod
¶
Get linear progress style from theme.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
theme
|
'Theme'
|
Theme to load style from. |
required |
variant
|
str
|
Variant name ("default" or "flat"). |
'default'
|
Returns:
| Type | Description |
|---|---|
'LinearProgressIndicatorStyle'
|
LinearProgressIndicatorStyle resolved from theme or fallback preset. |
Source code in src/nuiitivet/material/styles/progress_indicator_style.py
Snackbar
¶
Snackbar(message: str, *, padding: Optional[Union[int, Tuple[int, int, int, int]]] = None, style: Optional[SnackbarStyle] = None, key: Optional[str] = None)
Bases: ComposableWidget
Material Design Snackbar.
Displays a brief message at the bottom of the screen.
Source code in src/nuiitivet/material/snackbar.py
BasicDialogIntent
dataclass
¶
Intent for showing a Material Basic Dialog.
Attributes:
| Name | Type | Description |
|---|---|---|
title |
str | None
|
The title of the dialog. |
message |
str | None
|
The message body of the dialog. |
icon |
Any | None
|
The icon to display. Can be a Widget or other supported type. |
ColorRole
¶
Bases: Enum
Material 3 Color Roles — canonical 26 roles used by M3.
SchemeVariant
¶
Bases: Enum
Algorithm used to derive a tonal palette from a seed color.
Each member's value is the corresponding materialyoucolor.Variant
attribute name.
Text
¶
Text(label: Union[str, ReadOnlyObservableProtocol[Any]], *, width: SizingLike = None, height: SizingLike = None, padding: Union[int, Tuple[int, int], Tuple[int, int, int, int]] = 0, style: Optional['TextStyle'] = None, type_scale: Optional[TypeScaleToken] = None, alignment: Literal['start', 'center', 'end'] = 'start', max_lines: Optional[int] = None, overflow: Literal['visible', 'clip', 'ellipsis'] = 'visible', truncation: Literal['tail', 'head', 'middle'] = 'tail', soft_wrap: bool = True, key: Optional[str] = None)
Bases: TextBase
Material text widget.
Defaults to the current Material theme TextStyle.
Initialize Material Text widget.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
label
|
Union[str, ReadOnlyObservableProtocol[Any]]
|
The text content to display. Can be a string or an Observable. |
required |
width
|
SizingLike
|
Width specification. |
None
|
height
|
SizingLike
|
Height specification. |
None
|
padding
|
Union[int, Tuple[int, int], Tuple[int, int, int, int]]
|
Padding around the text. |
0
|
style
|
Optional['TextStyle']
|
Custom Material TextStyle (color, font_family). |
None
|
type_scale
|
Optional[TypeScaleToken]
|
MD3 type-scale token supplying typography. Defaults to Body Medium. |
None
|
alignment
|
Literal['start', 'center', 'end']
|
Horizontal text alignment ( |
'start'
|
max_lines
|
Optional[int]
|
Maximum number of lines ( |
None
|
overflow
|
Literal['visible', 'clip', 'ellipsis']
|
Overflow handling: |
'visible'
|
truncation
|
Literal['tail', 'head', 'middle']
|
Ellipsis position: |
'tail'
|
soft_wrap
|
bool
|
Whether to wrap at soft line breaks when width is bounded. |
True
|
key
|
Optional[str]
|
Stable widget identity for dev-bridge targeting and hot reload. |
None
|
Source code in src/nuiitivet/material/text.py
style
property
¶
Return the current text style, resolving from theme if necessary.
Navigator
¶
Navigator(screen: Route | Widget | None = None, *, layer_composer: NavigationLayerComposer | None = None, key: str | None = None)
Bases: Navigator
Navigator that applies Material default transition specs.
Defaults its layer composer to :class:MaterialNavigationLayerComposer so
that page transitions actually render their Material fade — including when
the navigator is built directly via :meth:Navigator.intents /
:meth:Navigator.routes (not only the implicit navigator MaterialApp
wires up). Without it the core :class:_DefaultNavigationLayerComposer
composites both routes at full opacity, so the transition never animates.
Source code in src/nuiitivet/material/navigator.py
Overlay
¶
Overlay(*, intent_resolver: IntentResolver | None = None, intents: Mapping[type[Any], Callable[[Any], Widget | Route]] | None = None, key: str | None = None)
Bases: Overlay
Overlay subclass that provides Material-specific helpers.
Source code in src/nuiitivet/material/overlay.py
dialog
¶
dialog(dialog: Widget | Any, *, dismiss_on_outside_tap: bool = True) -> OverlayHandle[Any]
Display a modal Material dialog.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
dialog
|
Widget | Any
|
A :class: |
required |
dismiss_on_outside_tap
|
bool
|
Whether tapping the scrim dismisses the
dialog. Defaults to |
True
|
Returns:
| Name | Type | Description |
|---|---|---|
An |
OverlayHandle[Any]
|
class: |
Source code in src/nuiitivet/material/overlay.py
snackbar
¶
snackbar(message: str | Snackbar, *, duration: float = 3.0) -> OverlayHandle[None]
Display a brief, non-blocking Material snackbar.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
message
|
str | Snackbar
|
The message text, or a pre-built :class: |
required |
duration
|
float
|
Seconds before the snackbar auto-dismisses. Defaults to |
3.0
|
Returns:
| Name | Type | Description |
|---|---|---|
An |
OverlayHandle[None]
|
class: |
Source code in src/nuiitivet/material/overlay.py
loading
¶
loading(indicator: Widget | Any | None = None) -> OverlayHandle[Any]
Show a loading indicator overlay and return a handle for manual dismissal.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
indicator
|
Widget | Any | None
|
Widget or intent to display as the loading indicator.
Defaults to the built-in :class: |
None
|
Returns:
| Name | Type | Description |
|---|---|---|
An |
OverlayHandle[Any]
|
class: |
Source code in src/nuiitivet/material/overlay.py
while_loading
¶
while_loading(indicator: Widget | Any | None = None) -> WhileLoading
Return a context manager that shows a loading indicator for the duration of a block.
Use this form when the loading state is scoped to a with or async with block::
with MaterialOverlay.of(self).while_loading():
do_work()
async with MaterialOverlay.of(self).while_loading():
await fetch_data()
Internally delegates show/close to :meth:loading.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
indicator
|
Widget | Any | None
|
Widget or intent to display as the loading indicator.
Defaults to the built-in :class: |
None
|
Returns:
| Name | Type | Description |
|---|---|---|
A |
WhileLoading
|
class: |
Source code in src/nuiitivet/material/overlay.py
side_sheet
¶
side_sheet(sheet: Widget, *, side: Literal['right', 'left'] = 'right', dismiss_on_outside_tap: bool = True) -> OverlayHandle[Any]
Display a modal side sheet.
The slide-in edge is a placement concern owned by this method: side
controls the sheet's alignment, transition direction, and which (inner,
away-from-edge) corners are rounded. The corner rounding is applied here
via the :func:corner_radius modifier, using the radius from
SideSheet.style; the :class:SideSheet widget itself renders a
square container.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
sheet
|
Widget
|
SideSheet widget (or a wrapper such as one produced by
|
required |
side
|
Literal['right', 'left']
|
Edge the sheet slides in from ( |
'right'
|
dismiss_on_outside_tap
|
bool
|
Whether tapping the scrim dismisses the sheet.
Defaults to |
True
|
Source code in src/nuiitivet/material/overlay.py
bottom_sheet
¶
bottom_sheet(sheet: Widget, *, dismiss_on_outside_tap: bool = True) -> OverlayHandle[Any]
Display a modal bottom sheet sliding up from the bottom edge.
Visual styling (background, size, corner radius) is fully owned by the
:class:BottomSheet widget.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
sheet
|
Widget
|
BottomSheet widget (or a wrapper such as one produced by
|
required |
dismiss_on_outside_tap
|
bool
|
Whether tapping the scrim dismisses the sheet.
Defaults to |
True
|
Source code in src/nuiitivet/material/overlay.py
WhileLoading
¶
WhileLoading(overlay: _LoadingHost, indicator: Widget | Any | None)
Bases: AbstractContextManager[None], AbstractAsyncContextManager[None]
Context manager that shows a loading indicator for the duration of a block.
Returned by :meth:MaterialOverlay.while_loading. Supports both with and
async with usage::
with MaterialOverlay.of(self).while_loading():
do_work()
async with MaterialOverlay.of(self).while_loading():
await fetch_data()
Source code in src/nuiitivet/material/overlay.py
OverlayProtocol
¶
Bases: OverlayProtocol, Protocol
The Material overlay surface a ViewModel depends on.
Exported as nuiitivet.material.OverlayProtocol, mirroring how
nuiitivet.material.Overlay names
:class:~nuiitivet.material.overlay.MaterialOverlay. Annotate an injected
overlay with it so the ViewModel presents content without owning widgets::
class ItemViewModel:
def __init__(self, overlay: nv.OverlayProtocol) -> None:
self._overlay = overlay
async def delete(self) -> None:
await self._overlay.dialog(BasicDialogIntent(title="Delete?"))
Prefer passing intents rather than widgets: dialog and loading
resolve them through the overlay's intent resolver, keeping widget
construction in the View layer. The sheet methods still require a widget --
intent support for them is not implemented yet.
while_loading
¶
while_loading(indicator: Widget | Any | None = None) -> WhileLoading
Return a (sync or async) context manager that shows a loading indicator.
side_sheet
¶
side_sheet(sheet: Widget, *, side: Literal['right', 'left'] = 'right', dismiss_on_outside_tap: bool = True) -> OverlayHandle[Any]
ThemeFactory
¶
Factory for creating Themes with Material Design configuration.
from_seed
staticmethod
¶
from_seed(seed_color: str, mode: str = 'light', name: str = '', *, variant: SchemeVariant = DEFAULT_VARIANT, contrast_level: float = DEFAULT_CONTRAST_LEVEL) -> Theme
Create a Material theme from a seed color.
variant and contrast_level default to the Material 3 defaults; see
nuiitivet.material.theme.palette.from_seed.
Source code in src/nuiitivet/material/theme/material_theme.py
from_seed_pair
staticmethod
¶
from_seed_pair(seed_color: str, name: str = '', *, variant: SchemeVariant = DEFAULT_VARIANT, contrast_level: float = DEFAULT_CONTRAST_LEVEL) -> Tuple[Theme, Theme]
Create light and dark themes from a seed color.
Source code in src/nuiitivet/material/theme/material_theme.py
DockedToolbar
¶
DockedToolbar(buttons: Sequence[Widget], *, style: Optional[ToolbarStyle] = None, key: Optional[str] = None)
Bases: _ToolbarBase
Material Design 3 docked toolbar.
This toolbar is edge-to-edge and therefore does not expose external padding.
Initialize DockedToolbar.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
buttons
|
Sequence[Widget]
|
Widgets placed inside the toolbar. Prefer |
required |
style
|
Optional[ToolbarStyle]
|
Optional toolbar style. Defaults to the theme's toolbar
style, which itself falls back to |
None
|
key
|
Optional[str]
|
Stable widget identity for dev-bridge targeting and hot reload. |
None
|
Source code in src/nuiitivet/material/toolbar.py
HorizontalFloatingToolbar
¶
HorizontalFloatingToolbar(buttons: Sequence[Widget], *, padding: PaddingLike = 0, style: Optional[ToolbarStyle] = None, key: Optional[str] = None)
Bases: _FloatingToolbarBase
Material Design 3 horizontal floating toolbar.
Lays out action buttons in a row inside a fully rounded floating container.
Initialize HorizontalFloatingToolbar.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
buttons
|
Sequence[Widget]
|
Widgets placed inside the toolbar. Prefer |
required |
padding
|
PaddingLike
|
External padding around the floating toolbar. |
0
|
style
|
Optional[ToolbarStyle]
|
Optional toolbar style. Defaults to |
None
|
key
|
Optional[str]
|
Stable widget identity for dev-bridge targeting and hot reload. |
None
|
Source code in src/nuiitivet/material/toolbar.py
VerticalFloatingToolbar
¶
VerticalFloatingToolbar(buttons: Sequence[Widget], *, padding: PaddingLike = 0, style: Optional[ToolbarStyle] = None, key: Optional[str] = None)
Bases: _FloatingToolbarBase
Material Design 3 vertical floating toolbar.
Lays out action buttons in a column inside a fully rounded floating container.
Initialize VerticalFloatingToolbar.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
buttons
|
Sequence[Widget]
|
Widgets placed inside the toolbar. Prefer |
required |
padding
|
PaddingLike
|
External padding around the floating toolbar. |
0
|
style
|
Optional[ToolbarStyle]
|
Optional toolbar style. Defaults to |
None
|
key
|
Optional[str]
|
Stable widget identity for dev-bridge targeting and hot reload. |
None
|
Source code in src/nuiitivet/material/toolbar.py
Tooltip
¶
Tooltip(message: str, *, width: SizingLike = None, height: SizingLike = None, style: TooltipStyle | None = None, key: str | None = None)
Bases: ComposableWidget
Material Design 3 plain tooltip widget.
Initialize Tooltip.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
message
|
str
|
Short plain-text tooltip message. |
required |
width
|
SizingLike
|
Optional width sizing. |
None
|
height
|
SizingLike
|
Optional height sizing. |
None
|
style
|
TooltipStyle | None
|
Optional style token set. Defaults to TooltipStyle.standard(). |
None
|
key
|
str | None
|
Stable widget identity for dev-bridge targeting and hot reload. |
None
|
Source code in src/nuiitivet/material/tooltip_widgets.py
style
property
¶
Return tooltip style resolved from user style or current theme.
RichTooltip
¶
RichTooltip(supporting_text: str, *, subhead: str | None = None, action_label: str | None = None, on_action_click: Callable[[], None] | None = None, action_label_2: str | None = None, on_action_click_2: Callable[[], None] | None = None, width: SizingLike = None, height: SizingLike = None, style: RichTooltipStyle | None = None, key: str | None = None)
Bases: ComposableWidget
Material Design 3 rich tooltip widget.
Initialize RichTooltip.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
supporting_text
|
str
|
Main explanatory text. |
required |
subhead
|
str | None
|
Optional short title line. |
None
|
action_label
|
str | None
|
Optional primary text button label. |
None
|
on_action_click
|
Callable[[], None] | None
|
Optional callback for primary action. |
None
|
action_label_2
|
str | None
|
Optional secondary text button label. |
None
|
on_action_click_2
|
Callable[[], None] | None
|
Optional callback for secondary action. |
None
|
width
|
SizingLike
|
Optional width sizing. |
None
|
height
|
SizingLike
|
Optional height sizing. |
None
|
style
|
RichTooltipStyle | None
|
Optional style token set. Defaults to RichTooltipStyle.standard(). |
None
|
key
|
str | None
|
Stable widget identity for dev-bridge targeting and hot reload. |
None
|
Source code in src/nuiitivet/material/tooltip_widgets.py
style
property
¶
Return rich tooltip style resolved from user style or current theme.
preferred_size
¶
preferred_size(max_width: Optional[int] = None, max_height: Optional[int] = None) -> Tuple[int, int]
Return preferred size clamped to [min_width, max_width] when auto-sized.
Source code in src/nuiitivet/material/tooltip_widgets.py
SideSheetStyle
dataclass
¶
SideSheetStyle(width: SizingLike = 400, height: SizingLike = 'wt', corner_radius: float = 16.0, background_color: ColorSpec = SURFACE_CONTAINER_LOW)
Immutable container style for a modal side sheet.
The framework wraps caller-supplied content in a container sized by this style.
height defaults to "wt" so the sheet spans the full screen height;
any other weight does the same (see the module docstring).
corner_radius is applied to the inner (away-from-edge) corners only.
background_color defaults to ColorRole.SURFACE_CONTAINER_LOW per M3 spec.
copy_with
¶
BottomSheetStyle
dataclass
¶
BottomSheetStyle(width: SizingLike = 'wt', height: SizingLike = None, corner_radius: float = 28.0, background_color: ColorSpec = SURFACE_CONTAINER_LOW)
Immutable container style for a modal bottom sheet.
The framework wraps caller-supplied content in a container sized by this style.
width defaults to "wt" so the sheet spans the full screen width;
any other weight does the same (see the module docstring).
height=None means the container sizes to its content; a fixed number
(height=400) is the way to ask for a partial-height sheet.
corner_radius is applied to the top corners only.
background_color defaults to ColorRole.SURFACE_CONTAINER_LOW per M3 spec.
copy_with
¶
StandardSideSheetStyle
dataclass
¶
StandardSideSheetStyle(width: SizingLike = 256, height: SizingLike = 'wt', corner_radius: float = 0.0, background_color: ColorSpec = SURFACE, show_divider: bool = True)
Immutable container style for a standard (docked) side sheet.
A standard side sheet is part of the layout and sits beside main content. It does not use an overlay or scrim.
width defaults to 256 per M3 token md.comp.sheet.side.docked.container.width.
height defaults to "wt" so the sheet spans the full content area height;
any other weight does the same (see the module docstring).
corner_radius defaults to 0.0 per M3 token
md.comp.sheet.side.docked.container.shape (corner.none).
background_color defaults to ColorRole.SURFACE per M3 token
md.comp.sheet.side.docked.standard.container.color (elevation level 0).
show_divider defaults to True. When True, a vertical
Divider is rendered on the edge facing the main content area.
The divider color is governed by the theme's outlineVariant role
per M3 token md.comp.sheet.side.docked.divider.color.
copy_with
¶
SideSheet
¶
SideSheet(content: Widget, *, headline: Union[str, ObservableBase[str]], on_back: Optional[Callable[[], None]] = None, show_back_button: Union[bool, ObservableBase[bool]] = False, style: Optional[SideSheetStyle] = None, key: Optional[str] = None)
Bases: ComposableWidget, OverlayAware[None]
Modal side sheet container widget.
Renders an M3-compliant header (optional Back button, Headline, Close button) above
content. Pass this widget to MaterialOverlay.side_sheet().
The header layout is fixed by M3 spec::
[ Back (optional) ] [ Headline ] [ Close ]
Note
The Back button is visible only when show_back_button is truthy and
on_back is not None. Providing show_back_button=True alone
without on_back will silently suppress the button.
The Close button always dismisses the sheet through the overlay's unified
dismissal pipeline. To intercept the close (for unsaved changes, etc.),
attach a will_pop modifier::
overlay.side_sheet(
SideSheet(content, headline="Settings")
.modifier(will_pop(on_will_pop=lambda: not has_unsaved_changes))
)
The slide-in edge and corner rounding are owned by
MaterialOverlay.side_sheet(sheet, side=...), not by this widget.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
content
|
Widget
|
Widget to display below the header. |
required |
headline
|
Union[str, ObservableBase[str]]
|
Header title text (str or Observable[str]). Required by M3. |
required |
on_back
|
Optional[Callable[[], None]]
|
Callback invoked when the Back icon button is pressed. Back button visibility is controlled separately by show_back_button. |
None
|
show_back_button
|
Union[bool, ObservableBase[bool]]
|
Whether to show the Back icon button.
Accepts |
False
|
style
|
Optional[SideSheetStyle]
|
Container style. Defaults to :class: |
None
|
Initialize SideSheet.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
content
|
Widget
|
Widget to display below the header. |
required |
headline
|
Union[str, ObservableBase[str]]
|
Header title text (str or Observable[str]). |
required |
on_back
|
Optional[Callable[[], None]]
|
Callback for the Back icon button press. |
None
|
show_back_button
|
Union[bool, ObservableBase[bool]]
|
Back button visibility (bool or Observable[bool]).
Defaults to |
False
|
style
|
Optional[SideSheetStyle]
|
Container style. Defaults to :class: |
None
|
key
|
Optional[str]
|
Stable widget identity for dev-bridge targeting and hot reload. |
None
|
Source code in src/nuiitivet/material/sheet.py
on_mount
¶
Mount and subscribe to show_back_button observable if provided.
Source code in src/nuiitivet/material/sheet.py
build
¶
build() -> Widget
Build the sheet: outer Box with header Row and content Column.
Source code in src/nuiitivet/material/sheet.py
BottomSheet
¶
BottomSheet(content: Widget, *, headline: Union[str, ObservableBase[str]], style: Optional[BottomSheetStyle] = None, key: Optional[str] = None)
Bases: ComposableWidget, OverlayAware[None]
Modal bottom sheet container widget.
Renders an M3-compliant header (Headline, Close button) above content.
Pass this widget to MaterialOverlay.bottom_sheet().
The header layout is fixed by M3 spec::
[ Headline ] [ Close ]
The Close button always dismisses the sheet through the overlay's unified
dismissal pipeline. To intercept the close (for unsaved changes, etc.),
attach a will_pop modifier.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
content
|
Widget
|
Widget to display below the header. |
required |
headline
|
Union[str, ObservableBase[str]]
|
Header title text (str or Observable[str]). Required by M3. |
required |
style
|
Optional[BottomSheetStyle]
|
Container size, background, and shape options.
Defaults to :class: |
None
|
Initialize BottomSheet.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
content
|
Widget
|
Widget to display below the header. |
required |
headline
|
Union[str, ObservableBase[str]]
|
Header title text (str or Observable[str]). |
required |
style
|
Optional[BottomSheetStyle]
|
Container style. Defaults to :class: |
None
|
key
|
Optional[str]
|
Stable widget identity for dev-bridge targeting and hot reload. |
None
|
Source code in src/nuiitivet/material/sheet.py
build
¶
build() -> Widget
Build the sheet: outer Box with header Row and content Column.
Source code in src/nuiitivet/material/sheet.py
StandardSideSheet
¶
StandardSideSheet(content: Widget, *, opened: Union[bool, MutableObservableBase[bool]] = True, on_close_click: Optional[Callable[[], None]] = None, headline: Optional[Union[str, ObservableBase[str]]] = None, side: Literal['right', 'left'] = 'right', style: Optional[StandardSideSheetStyle] = None, key: Optional[str] = None)
Bases: ComposableWidget
Material Design 3 standard (docked) side sheet.
A standard side sheet is a permanent part of the layout, sitting beside the main content. It owns its open/close animation: the sheet stays mounted while its allocated width animates between the style width and zero::
opened: Observable[bool] = Observable(True)
Row([
main_content,
StandardSideSheet(panel_content, headline="Filters", opened=opened),
])
Toggling the sheet is a plain write to opened
(opened.value = not opened.value). Conditionally rendering the sheet
instead would unmount it and skip the animation.
The close icon button is rendered when the sheet can act on a press, i.e.
when opened is a writable observable, when on_close_click is given, or
both. With a literal bool opened and no callback there is nothing a
press could do, so no button is shown.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
content
|
Widget
|
Widget to display inside the sheet. |
required |
opened
|
Union[bool, MutableObservableBase[bool]]
|
|
True
|
on_close_click
|
Optional[Callable[[], None]]
|
Callback invoked when the close icon button is
pressed. Supplying it disables the default auto-close: the
sheet no longer writes |
None
|
headline
|
Optional[Union[str, ObservableBase[str]]]
|
Optional header title text ( |
None
|
side
|
Literal['right', 'left']
|
Edge the sheet is attached to ( |
'right'
|
style
|
Optional[StandardSideSheetStyle]
|
Container style. Defaults to :class: |
None
|
Initialize StandardSideSheet.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
content
|
Widget
|
Widget to display inside the sheet. |
required |
opened
|
Union[bool, MutableObservableBase[bool]]
|
|
True
|
on_close_click
|
Optional[Callable[[], None]]
|
Callback for the close icon button. Supplying it
disables the default |
None
|
headline
|
Optional[Union[str, ObservableBase[str]]]
|
Optional header title (str or Observable[str]). |
None
|
side
|
Literal['right', 'left']
|
Attachment edge ( |
'right'
|
style
|
Optional[StandardSideSheetStyle]
|
Container style. Defaults to :class: |
None
|
key
|
Optional[str]
|
Stable widget identity for dev-bridge targeting and hot reload. |
None
|
Source code in src/nuiitivet/material/sheet.py
on_mount
¶
Mount and subscribe to headline observable if provided.
build
¶
build() -> Widget
Build the sheet: a Collapsible wrapping the sheet container Box.
Source code in src/nuiitivet/material/sheet.py
GroupButton
¶
GroupButton(label: 'str | ObservableBase[str] | None' = None, icon: 'Symbol | str | ObservableBase | None' = None, *, selected: 'bool | MutableObservableBase[bool]' = False, on_change: Optional[BoolCallback] = None, disabled: 'bool | MutableObservableBase[bool]' = False, width: SizingLike = None, style: 'Optional[ButtonGroupStyle]' = None, key: Optional[str] = None)
Bases: InteractiveWidget
A single interactive segment in a ButtonGroup (Standard or Connected).
Handles position-aware corner-radius shape morphing via EXPRESSIVE_FAST_SPATIAL
motion on press / release. set_position() is called exclusively by the
containing _ButtonGroupBase during on_mount; it is not part of the
public user API.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
label
|
'str | ObservableBase[str] | None'
|
Optional text label. Can be a plain |
None
|
icon
|
'Symbol | str | ObservableBase | None'
|
Optional icon. Accepts a |
None
|
selected
|
'bool | MutableObservableBase[bool]'
|
Initial selected (toggle) state. Pass an
|
False
|
on_change
|
Optional[BoolCallback]
|
Callback fired with the new |
None
|
disabled
|
'bool | MutableObservableBase[bool]'
|
Whether the item ignores pointer events. |
False
|
width
|
SizingLike
|
Optional width sizing. |
None
|
style
|
'Optional[ButtonGroupStyle]'
|
Optional style override. If omitted, the containing group's style is used; a group button standing on its own follows the theme's standard-group style. |
None
|
Initialize GroupButton.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
label
|
'str | ObservableBase[str] | None'
|
Text label, or an observable string. |
None
|
icon
|
'Symbol | str | ObservableBase | None'
|
Icon symbol, string name, or observable icon. |
None
|
selected
|
'bool | MutableObservableBase[bool]'
|
Initial selected state, or an observable bool. |
False
|
on_change
|
Optional[BoolCallback]
|
Toggle-state change callback. |
None
|
disabled
|
'bool | MutableObservableBase[bool]'
|
Disable interaction. |
False
|
width
|
SizingLike
|
Width sizing spec. |
None
|
style
|
'Optional[ButtonGroupStyle]'
|
Visual style override. |
None
|
key
|
Optional[str]
|
Stable widget identity for dev-bridge targeting and hot reload. |
None
|
Source code in src/nuiitivet/material/button_group.py
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 | |
preferred_size
¶
preferred_size(max_width: Optional[int] = None, max_height: Optional[int] = None) -> Tuple[int, int]
Return preferred size.
Connected groups enforce a visual minimum width (M3: 48dp for XS/S segments). Standard groups are content-fit: their 48dp spec value is an accessible tap-target requirement, not a visual width floor, so it is intentionally not applied to the rendered width here.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
max_width
|
Optional[int]
|
Available width constraint. |
None
|
max_height
|
Optional[int]
|
Available height constraint. |
None
|
Returns:
| Type | Description |
|---|---|
Tuple[int, int]
|
|
Source code in src/nuiitivet/material/button_group.py
set_position
¶
set_position(position: ButtonGroupPosition, adjacent_animation: bool = True) -> None
Configure this item's position within its group.
Called exclusively by _ButtonGroupBase.on_mount(). Snaps the
corner radius to the idle value for the given position without
animation, then arms the EXPRESSIVE_FAST_SPATIAL motion for
subsequent press interactions.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
position
|
ButtonGroupPosition
|
One of |
required |
adjacent_animation
|
bool
|
|
True
|
Source code in src/nuiitivet/material/button_group.py
on_mount
¶
Subscribe to corner animation and external selected observable.
Source code in src/nuiitivet/material/button_group.py
StandardButtonGroup
¶
StandardButtonGroup(items: Sequence[GroupButton], *, style: 'Optional[StandardButtonGroupStyle]' = None, key: Optional[str] = None)
Bases: _ButtonGroupBase
A ButtonGroup that organises action or toggle segments horizontally.
Width fits the combined item widths. When a segment is activated (pressed)
or selected, the MD3 adjacent interaction runs: the active segment animates
its width, shape, and (via centered content) padding, while its
direct neighbors shrink to compensate so the group's overall width stays
stable. All transitions use M3 Expressive (EXPRESSIVE_FAST_SPATIAL)
motion. Item selected states are independent — no group-level enforcement.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
items
|
Sequence[GroupButton]
|
Between 2 and 5 |
required |
style
|
'Optional[StandardButtonGroupStyle]'
|
Visual style. Use |
None
|
Initialize StandardButtonGroup.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
items
|
Sequence[GroupButton]
|
Between 2 and 5 |
required |
style
|
'Optional[StandardButtonGroupStyle]'
|
Visual style override. Defaults to the theme's standard
button group style, which itself falls back to
|
None
|
key
|
Optional[str]
|
Stable widget identity for dev-bridge targeting and hot reload. |
None
|
Source code in src/nuiitivet/material/button_group.py
ConnectedButtonGroup
¶
ConnectedButtonGroup(items: Sequence[GroupButton], *, select_mode: Literal['single', 'multi'] = 'single', style: 'Optional[ConnectedButtonGroupStyle]' = None, key: Optional[str] = None)
Bases: _ButtonGroupBase
A ButtonGroup that functions as an option selector / view switcher.
Width expands to fill the containing widget (width="wt"). Items
share space equally (Sizing.weight(1)). Only corner shapes animate on
press — adjacent segment corners are unaffected. Selection is always
enforced by the group.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
items
|
Sequence[GroupButton]
|
Between 2 and 5 |
required |
select_mode
|
Literal['single', 'multi']
|
|
'single'
|
style
|
'Optional[ConnectedButtonGroupStyle]'
|
Visual style. Use |
None
|
Initialize ConnectedButtonGroup.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
items
|
Sequence[GroupButton]
|
Between 2 and 5 |
required |
select_mode
|
Literal['single', 'multi']
|
|
'single'
|
style
|
'Optional[ConnectedButtonGroupStyle]'
|
Visual style override. Defaults to the theme's connected
button group style, which itself falls back to
|
None
|
key
|
Optional[str]
|
Stable widget identity for dev-bridge targeting and hot reload. |
None
|
Source code in src/nuiitivet/material/button_group.py
on_mount
¶
Assign positions, set weight widths, and wire group selection logic.
Source code in src/nuiitivet/material/button_group.py
StandardButtonGroupStyle
dataclass
¶
StandardButtonGroupStyle(background: Optional[ColorSpec] = None, foreground: Optional[ColorSpec] = None, border_color: Optional[ColorSpec] = None, border_width: float = 0.0, selected_background: Optional[ColorSpec] = None, selected_foreground: Optional[ColorSpec] = None, container_height: int = 40, item_gap: int = 12, min_item_width: int = 48, inner_padding: int = 16, icon_size: int = 20, label_size: int = 14, icon_label_space: int = 8, outer_corner_radius: float = 20.0, pressed_outer_corner_radius: float = 12.0, pressed_inner_corner_radius: float = 12.0, pressed_width_multiplier: float = 0.15, overlay_color: Optional[ColorSpec] = None, overlay_alpha: float = 0.12)
Immutable style for StandardButtonGroup (M3-compliant).
All segments are independent fully-rounded pills. There is no
junction-corner concept; inner_corner_radius always equals
outer_corner_radius (exposed as a read-only property).
Use filled(), tonal(), or outlined() to create a preset,
optionally passing a ButtonSize.
inner_corner_radius
property
¶
Inner corner radius equals outer (fully-rounded pill).
selected_inner_corner_radius
property
¶
Not applicable; returns 0.0.
selected_border_color
property
¶
No distinct selected border; falls back to border_color.
copy_with
¶
filled
classmethod
¶
filled(size: ButtonSize = 's') -> 'StandardButtonGroupStyle'
Create a filled-variant style.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
size
|
ButtonSize
|
M3 size token preset ( |
's'
|
Source code in src/nuiitivet/material/styles/button_group_style.py
tonal
classmethod
¶
tonal(size: ButtonSize = 's') -> 'StandardButtonGroupStyle'
Create a tonal-variant style.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
size
|
ButtonSize
|
M3 size token preset ( |
's'
|
Source code in src/nuiitivet/material/styles/button_group_style.py
outlined
classmethod
¶
outlined(size: ButtonSize = 's') -> 'StandardButtonGroupStyle'
Create an outlined-variant style.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
size
|
ButtonSize
|
M3 size token preset ( |
's'
|
Source code in src/nuiitivet/material/styles/button_group_style.py
preset
classmethod
¶
Return the framework preset, ignoring any theme.
This is what a standard button group renders with before it is
mounted, and what :meth:from_theme falls back to when no Material
theme is installed.
Returns:
| Type | Description |
|---|---|
'StandardButtonGroupStyle'
|
The filled standard-group style at size |
Source code in src/nuiitivet/material/styles/button_group_style.py
from_theme
classmethod
¶
Resolve the standard button group style from theme.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
theme
|
'Theme | None'
|
The active theme, or |
required |
Returns:
| Type | Description |
|---|---|
'StandardButtonGroupStyle'
|
Resolved standard-group style. |
Source code in src/nuiitivet/material/styles/button_group_style.py
ConnectedButtonGroupStyle
dataclass
¶
ConnectedButtonGroupStyle(background: Optional[ColorSpec] = None, foreground: Optional[ColorSpec] = None, border_color: Optional[ColorSpec] = None, border_width: float = 0.0, selected_background: Optional[ColorSpec] = None, selected_foreground: Optional[ColorSpec] = None, selected_border_color: Optional[ColorSpec] = None, container_height: int = 40, item_gap: int = 2, min_item_width: int = 48, icon_size: int = 20, label_size: int = 14, icon_label_space: int = 8, outer_corner_radius: float = 20.0, inner_corner_radius: float = 8.0, pressed_outer_corner_radius: float = 8.0, pressed_inner_corner_radius: float = 4.0, selected_inner_corner_radius: float = 0.0, overlay_color: Optional[ColorSpec] = None, overlay_alpha: float = 0.12)
Immutable style for ConnectedButtonGroup (M3-compliant).
Segments are tightly connected with distinct junction corners.
Supports selection-state colours and a separate
selected_inner_corner_radius.
Use filled(), tonal(), or outlined() to create a preset,
optionally passing a ButtonSize.
copy_with
¶
filled
classmethod
¶
filled(size: ButtonSize = 's') -> 'ConnectedButtonGroupStyle'
Create a filled-variant style.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
size
|
ButtonSize
|
M3 size token preset ( |
's'
|
Source code in src/nuiitivet/material/styles/button_group_style.py
tonal
classmethod
¶
tonal(size: ButtonSize = 's') -> 'ConnectedButtonGroupStyle'
Create a tonal-variant style.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
size
|
ButtonSize
|
M3 size token preset ( |
's'
|
Source code in src/nuiitivet/material/styles/button_group_style.py
outlined
classmethod
¶
outlined(size: ButtonSize = 's') -> 'ConnectedButtonGroupStyle'
Create an outlined-variant style.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
size
|
ButtonSize
|
M3 size token preset ( |
's'
|
Source code in src/nuiitivet/material/styles/button_group_style.py
preset
classmethod
¶
Return the framework preset, ignoring any theme.
This is what a connected button group renders with before it is
mounted, and what :meth:from_theme falls back to when no Material
theme is installed.
Returns:
| Type | Description |
|---|---|
'ConnectedButtonGroupStyle'
|
The filled connected-group style at size |
Source code in src/nuiitivet/material/styles/button_group_style.py
from_theme
classmethod
¶
Resolve the connected button group style from theme.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
theme
|
'Theme | None'
|
The active theme, or |
required |
Returns:
| Type | Description |
|---|---|
'ConnectedButtonGroupStyle'
|
Resolved connected-group style. |
Source code in src/nuiitivet/material/styles/button_group_style.py
SplitButton
¶
SplitButton(label: 'str | Any | None' = None, icon: 'Symbol | str | Any | None' = None, *, on_click: Optional[VoidCallback] = None, on_menu_toggle: Optional[BoolCallback] = None, menu_open: 'bool | MutableObservableBase[bool]' = False, disabled: 'bool | MutableObservableBase[bool]' = False, width: SizingLike = None, style: 'Optional[SplitButtonStyle]' = None, key: Optional[str] = None)
Bases: Box
Material Design 3 Expressive Split Button.
Combines a leading button (main action) with a trailing button (menu trigger). The two halves share an animated inner corner junction that morphs on hover and press. The trailing button's icon rotates 180° when the menu is opened.
Spec: https://m3.material.io/components/split-button/specs
Example::
SplitButton(
"Start",
icon="play_arrow",
on_click=lambda: start_action(),
on_menu_toggle=lambda open: handle_menu(open),
style=SplitButtonStyle.filled("s"),
)
Initialize SplitButton.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
label
|
'str | Any | None'
|
Text label for the leading button. Either |
None
|
icon
|
'Symbol | str | Any | None'
|
Leading icon for the leading button. Accepts a
:class: |
None
|
on_click
|
Optional[VoidCallback]
|
Callback invoked when the leading button is clicked. |
None
|
on_menu_toggle
|
Optional[BoolCallback]
|
Callback invoked with the new |
None
|
menu_open
|
'bool | MutableObservableBase[bool]'
|
Initial menu open (selected) state of the trailing
button. Pass an :class: |
False
|
disabled
|
'bool | MutableObservableBase[bool]'
|
Disables both button halves when |
False
|
width
|
SizingLike
|
Optional width sizing for the overall widget. |
None
|
style
|
'Optional[SplitButtonStyle]'
|
Visual style. Defaults to |
None
|
key
|
Optional[str]
|
Stable widget identity for dev-bridge targeting and hot reload. |
None
|
Source code in src/nuiitivet/material/split_button.py
menu_open
property
¶
Whether the menu is currently open (trailing button selected).
Returns:
| Type | Description |
|---|---|
bool
|
|
SplitButtonStyle
dataclass
¶
SplitButtonStyle(background: Optional[ColorSpec] = None, foreground: Optional[ColorSpec] = None, border_color: Optional[ColorSpec] = None, border_width: float = 0.0, elevation: int = 0, overlay_color: Optional[ColorSpec] = None, overlay_alpha: float = 0.12, container_height: int = 40, between_space: int = 2, outer_corner_radius: float = 20.0, inner_corner_radius: float = 4.0, inner_corner_hovered_radius: float = 12.0, inner_corner_pressed_radius: float = 12.0, leading_leading_space: int = 16, leading_trailing_space: int = 12, trailing_icon_size: int = 22, trailing_leading_space: int = 13, trailing_trailing_space: int = 13, menu_icon_offset: int = -1, label_font_size: int = 14, icon_size: int = 20)
Immutable style for :class:SplitButton (M3 Expressive-compliant).
Use the filled, elevated, tonal, or outlined factory
classmethods rather than constructing directly where possible.
All size-related tokens are driven by :data:SPLIT_BUTTON_SIZE_TOKENS.
copy_with
¶
Return a new style with the specified fields replaced.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
**changes
|
Any
|
Fields to override. |
{}
|
Returns:
| Type | Description |
|---|---|
'SplitButtonStyle'
|
A new :class: |
Source code in src/nuiitivet/material/styles/split_button_style.py
filled
classmethod
¶
filled(size: ButtonSize = 's') -> 'SplitButtonStyle'
Create a filled-variant style.
Uses Primary as the container colour.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
size
|
ButtonSize
|
M3 size token preset ( |
's'
|
Returns:
| Type | Description |
|---|---|
'SplitButtonStyle'
|
A new :class: |
Source code in src/nuiitivet/material/styles/split_button_style.py
elevated
classmethod
¶
elevated(size: ButtonSize = 's') -> 'SplitButtonStyle'
Create an elevated-variant style.
Uses Surface as the container colour with elevation level 1.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
size
|
ButtonSize
|
M3 size token preset ( |
's'
|
Returns:
| Type | Description |
|---|---|
'SplitButtonStyle'
|
A new :class: |
Source code in src/nuiitivet/material/styles/split_button_style.py
tonal
classmethod
¶
tonal(size: ButtonSize = 's') -> 'SplitButtonStyle'
Create a tonal-variant style.
Uses SecondaryContainer as the container colour.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
size
|
ButtonSize
|
M3 size token preset ( |
's'
|
Returns:
| Type | Description |
|---|---|
'SplitButtonStyle'
|
A new :class: |
Source code in src/nuiitivet/material/styles/split_button_style.py
outlined
classmethod
¶
outlined(size: ButtonSize = 's') -> 'SplitButtonStyle'
Create an outlined-variant style.
Uses a transparent background with an Outline-coloured border.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
size
|
ButtonSize
|
M3 size token preset ( |
's'
|
Returns:
| Type | Description |
|---|---|
'SplitButtonStyle'
|
A new :class: |
Source code in src/nuiitivet/material/styles/split_button_style.py
MaterialTransitionSpec
dataclass
¶
MaterialTransitionSpec(enter: TransitionDefinition, exit_: TransitionDefinition, barrier_mode: Literal['none', 'fade'] = 'none', enter_back: TransitionDefinition | None = None, exit_back: TransitionDefinition | None = None)
Material transition token for overlay/page lifecycle.
Carries enter / exit_ TransitionDefinitions plus a barrier_mode
that controls scrim opacity behavior:
"none": no scrim (page, snackbar)"fade": scrim fades in/out following progress (dialog, sheets)
enter_back / exit_back are the backward-direction (pop) variants.
Directional transitions such as Shared Axis (Z) reverse their motion when
navigating back, so a pop must not merely replay the forward enter /
exit_. When either is None the resolver falls back to the forward
definition, which keeps symmetric transitions (dialog, sheets, snackbar)
unchanged.
DatePicker
¶
DatePicker(value: ObservableProtocol[Optional[date]], *, on_change: Optional[Callable[[Optional[date]], None]] = None, on_confirm: Optional[Callable[[Optional[date]], None]] = None, on_cancel: Optional[Callable[[], None]] = None, min_date: Optional[date] = None, max_date: Optional[date] = None, labels: CalendarLabels = DEFAULT_CALENDAR_LABELS, style: Optional['DatePickerStyle'] = None, key: Optional[str] = None)
Bases: ComposableWidget
Material Design 3 inline calendar date picker.
An inline calendar widget that updates a shared observable value when the
user selects a date. The picker always stays visible (not a dialog), which
makes it composable with other widgets — :class:DockedDatePicker embeds
one as its dropdown content.
MD3 container: 360×456dp, Large corner rounding (16dp).
Selecting a day updates value immediately; the MD3 action row confirms or
abandons that selection. Standalone there is nothing to confirm to, so OK
is inert and Cancel clears the selection. An embedder that owns a dismissal
— :class:DockedDatePicker closing its dropdown — passes on_confirm and
on_cancel to take over both buttons.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
value
|
ObservableProtocol[Optional[date]]
|
Observable holding the currently selected :class: |
required |
on_change
|
Optional[Callable[[Optional[date]], None]]
|
Optional callback invoked after the value is updated. |
None
|
on_confirm
|
Optional[Callable[[Optional[date]], None]]
|
Optional callback invoked with |
None
|
on_cancel
|
Optional[Callable[[], None]]
|
Optional callback invoked when Cancel is pressed. When
omitted, Cancel clears |
None
|
min_date
|
Optional[date]
|
Earliest selectable date. |
None
|
max_date
|
Optional[date]
|
Latest selectable date. |
None
|
labels
|
CalendarLabels
|
Month names, weekday headers and first day of week the calendar renders with. The default is English and Sunday-first on every platform; it never reads the process locale. |
DEFAULT_CALENDAR_LABELS
|
style
|
Optional['DatePickerStyle']
|
Visual style. Defaults to :class: |
None
|
Initialize DatePicker.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
value
|
ObservableProtocol[Optional[date]]
|
Observable holding the selected date (or None). |
required |
on_change
|
Optional[Callable[[Optional[date]], None]]
|
Callback invoked when the user selects a date. |
None
|
on_confirm
|
Optional[Callable[[Optional[date]], None]]
|
Callback invoked with the selected date when OK is pressed. |
None
|
on_cancel
|
Optional[Callable[[], None]]
|
Callback invoked when Cancel is pressed; replaces the default "clear the selection" behavior. |
None
|
min_date
|
Optional[date]
|
Minimum selectable date. |
None
|
max_date
|
Optional[date]
|
Maximum selectable date. |
None
|
labels
|
CalendarLabels
|
Calendar display labels. |
DEFAULT_CALENDAR_LABELS
|
style
|
Optional['DatePickerStyle']
|
Optional style override. |
None
|
key
|
Optional[str]
|
Stable widget identity for dev-bridge targeting and hot reload. |
None
|
Source code in src/nuiitivet/material/date_picker.py
on_mount
¶
Subscribe to external value changes to keep the display in sync.
Source code in src/nuiitivet/material/date_picker.py
show_month
¶
Scroll the calendar to year/month without changing the value.
Returns the picker to the calendar view if a month or year list is open.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
year
|
int
|
Calendar year to display. |
required |
month
|
int
|
Calendar month to display (1–12). |
required |
Source code in src/nuiitivet/material/date_picker.py
build
¶
build() -> Widget
Build the inline calendar container with navigation header and calendar.
Source code in src/nuiitivet/material/date_picker.py
1461 1462 1463 1464 1465 1466 1467 1468 1469 1470 1471 1472 1473 1474 1475 1476 1477 1478 1479 1480 1481 1482 1483 1484 1485 1486 1487 1488 1489 1490 1491 1492 1493 1494 1495 1496 1497 1498 1499 1500 1501 1502 1503 1504 1505 1506 1507 1508 1509 1510 1511 1512 1513 1514 1515 1516 1517 1518 1519 1520 1521 1522 1523 1524 1525 1526 1527 1528 1529 1530 1531 1532 1533 1534 1535 1536 1537 1538 1539 1540 1541 1542 1543 1544 1545 1546 1547 1548 1549 1550 1551 1552 1553 1554 1555 1556 1557 1558 1559 1560 1561 1562 | |
DockedDatePicker
¶
DockedDatePicker(*, value: ReadOnlyObservableProtocol[str], on_change: Optional[Callable[[str], None]] = None, on_submit: Optional[Callable[[str], None]] = None, on_focus_change: Optional[FocusChangeCallback] = None, date_format: DateFormat = DEFAULT_DATE_FORMAT, min_date: Optional[date] = None, max_date: Optional[date] = None, labels: CalendarLabels = DEFAULT_CALENDAR_LABELS, label: str = 'Date', supporting_text: str | ReadOnlyObservableProtocol[str | None] | None = None, is_error: bool | ReadOnlyObservableProtocol[bool] = False, style: Optional['DockedDatePickerStyle'] = None, key: Optional[str] = None)
Bases: ComposableWidget
Material Design 3 Docked Date Picker.
A text field with a trailing calendar icon button that opens a
:class:DatePicker in a dropdown anchored below the field. The date can be
entered either by typing it or by picking it from the calendar.
value is the field's text, not a date. The typed date is derived
from it by the application::
self.date_text = nv.Observable("")
self.date = self.date_text.filter(nv.is_date, initial="").map(nv.parse_date)
nv.DockedDatePicker(value=self.date_text, label="Arrival")
Binding the text is what lets the application decide what an invalid date
means. Half-typed input is a normal state of a field the user is allowed to
type into, and only the application knows whether "06/1" should be shown
as an error yet, or whether a perfectly parseable date is nonetheless
unacceptable ("already booked"). So the widget reports no errors of its own:
pass supporting_text and is_error -- derived from the same text -- and
they have exactly one writer.
A date-bound field would have to keep the date and the text in step, and
would have to own the error state in order to describe text that has no
date. This binding removes both. :class:DatePicker, the inline calendar, keeps
Observable[Optional[date]]: a widget's value type follows its primary
input mechanism, and a calendar cannot be typed into.
Per MD3 the dropdown carries a Cancel/OK action row, so picking a day is a
selection rather than a commit. The calendar edits an internal draft; only
OK writes it into value. Cancel -- and any other dismissal, such as
tapping outside the dropdown -- drops the draft, so an abandoned selection is
never observable from value.
A read-only observable makes the field display-only, as it does for
:class:TextField; the calendar's OK then has nowhere to write and does
nothing.
date_format is one object rather than a parse and a format function,
because the two directions must be inverses and two separate arguments
cannot be checked for that. str(date_format) is its pattern, so the
same object also spells the hint an application chooses to show.
MD3 reference: md.comp.date-picker.docked.*
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
value
|
ReadOnlyObservableProtocol[str]
|
Observable holding the field's text. Typing writes into it, and
the calendar's OK writes the picked date into it formatted by
format. Keyword-only, so call sites written against the
pre-rename |
required |
on_change
|
Optional[Callable[[str], None]]
|
Optional callback invoked with the text as it changes, by typing or by the calendar alike. The observable bound to value carries the same signal. |
None
|
on_submit
|
Optional[Callable[[str], None]]
|
Optional callback invoked with the text when the user presses Enter -- a request to act, not a value settling. |
None
|
on_focus_change
|
Optional[FocusChangeCallback]
|
Optional callback invoked as focus arrives and leaves. Where blur-triggered work belongs, such as reformatting a half-typed date once the user has left the field. |
None
|
date_format
|
DateFormat
|
How text is read as a date and how a picked date is written back. Reading is used only to decide which month the calendar opens on and which day it highlights, never to validate -- unparseable text simply leaves the calendar where it was. One object rather than a parse and a format, because the two have to be inverses and nothing could check that they were. Pass the same one the application derives its date with, and they agree by construction. |
DEFAULT_DATE_FORMAT
|
min_date
|
Optional[date]
|
Earliest date selectable in the calendar. |
None
|
max_date
|
Optional[date]
|
Latest date selectable in the calendar. The calendar cannot produce a date outside these bounds, but typing can: enforcing a range on typed text is the application's, via is_error. An application that wants both states the bounds in both places. |
None
|
labels
|
CalendarLabels
|
Month names, weekday headers and first day of week the dropdown calendar renders with. The default is English and Sunday-first on every platform; it never reads the process locale. |
DEFAULT_CALENDAR_LABELS
|
label
|
str
|
Floating label for the text field. |
'Date'
|
supporting_text
|
str | ReadOnlyObservableProtocol[str | None] | None
|
Text shown below the field. Empty by default: the
widget has nothing of its own to say there, and the slot is where an
application puts its error message. For a format hint, pass
|
None
|
is_error
|
bool | ReadOnlyObservableProtocol[bool]
|
Whether to show the field in its error state. A separate axis from supporting_text: it recolors the whole field, so a field can be flagged without a message and carry one without being flagged. |
False
|
style
|
Optional['DockedDatePickerStyle']
|
Visual style. Defaults to :class: |
None
|
Initialize DockedDatePicker.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
value
|
ReadOnlyObservableProtocol[str]
|
Observable holding the field's text. |
required |
on_change
|
Optional[Callable[[str], None]]
|
Callback invoked with the text as it changes. |
None
|
on_submit
|
Optional[Callable[[str], None]]
|
Callback invoked with the text when Enter is pressed. |
None
|
on_focus_change
|
Optional[FocusChangeCallback]
|
Callback invoked as focus arrives and leaves. |
None
|
date_format
|
DateFormat
|
How text is read as a date and written back. |
DEFAULT_DATE_FORMAT
|
min_date
|
Optional[date]
|
Earliest date selectable in the calendar. |
None
|
max_date
|
Optional[date]
|
Latest date selectable in the calendar. |
None
|
labels
|
CalendarLabels
|
Calendar display labels. |
DEFAULT_CALENDAR_LABELS
|
label
|
str
|
Text field label. |
'Date'
|
supporting_text
|
str | ReadOnlyObservableProtocol[str | None] | None
|
Text shown below the field. Empty by default. |
None
|
is_error
|
bool | ReadOnlyObservableProtocol[bool]
|
Whether to show the field in its error state. |
False
|
style
|
Optional['DockedDatePickerStyle']
|
Optional style override. |
None
|
key
|
Optional[str]
|
Stable widget identity for dev-bridge targeting and hot reload. |
None
|
Source code in src/nuiitivet/material/date_picker.py
1657 1658 1659 1660 1661 1662 1663 1664 1665 1666 1667 1668 1669 1670 1671 1672 1673 1674 1675 1676 1677 1678 1679 1680 1681 1682 1683 1684 1685 1686 1687 1688 1689 1690 1691 1692 1693 1694 1695 1696 1697 1698 1699 1700 1701 1702 1703 1704 1705 1706 1707 1708 1709 1710 1711 1712 1713 1714 1715 1716 1717 1718 1719 1720 1721 1722 1723 1724 1725 1726 1727 1728 1729 1730 1731 1732 1733 1734 1735 1736 1737 | |
on_mount
¶
Track the text so the calendar follows it, and the dropdown state.
Both observers only ever write to the internal draft, so neither can
echo back into value -- there is nothing here to guard against.
Source code in src/nuiitivet/material/date_picker.py
build
¶
build() -> Widget
Build the text field with its anchored calendar dropdown.
Source code in src/nuiitivet/material/date_picker.py
ModalDatePicker
¶
ModalDatePicker(*, init_value: Optional[date] = None, supporting_text: str = 'Select date', min_date: Optional[date] = None, max_date: Optional[date] = None, style: Optional['ModalDatePickerStyle'] = None, key: Optional[str] = None)
Bases: ComposableWidget, OverlayAware[Optional[date]]
Material Design 3 Modal Date Picker (single date selection).
When shown via overlay.dialog(ModalDatePicker(...)), the returned
:class:OverlayHandle resolves to the selected date on confirmation or
None on cancellation::
result = await overlay.dialog(ModalDatePicker())
if result.value is not None:
selected_date: datetime.date = result.value
MD3 container: 360×524dp, Extra large corner rounding (28dp).
.. note::
Experimental implementation. This class does not yet fully comply with the
MD3 Expressive specification. Known limitation: the icon button that toggles
between :class:ModalDatePicker and :class:ModalDateInput is not implemented.
Deferred: Nuiitivet prioritizes the Docked variant as a desktop-oriented
framework.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
init_value
|
Optional[date]
|
Pre-selected date shown when the picker opens. |
None
|
supporting_text
|
str
|
Small label shown at the top of the header (14pt). |
'Select date'
|
min_date
|
Optional[date]
|
Earliest selectable date. |
None
|
max_date
|
Optional[date]
|
Latest selectable date. |
None
|
style
|
Optional['ModalDatePickerStyle']
|
Visual style. Defaults to :class: |
None
|
Initialize ModalDatePicker.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
init_value
|
Optional[date]
|
Initial selected date. |
None
|
supporting_text
|
str
|
Small label shown at the top of the header (14pt). |
'Select date'
|
min_date
|
Optional[date]
|
Minimum selectable date. |
None
|
max_date
|
Optional[date]
|
Maximum selectable date. |
None
|
style
|
Optional['ModalDatePickerStyle']
|
Optional style override. |
None
|
key
|
Optional[str]
|
Stable widget identity for dev-bridge targeting and hot reload. |
None
|
Source code in src/nuiitivet/material/date_picker.py
build
¶
build() -> Widget
Build the modal picker with header, calendar (or year grid), and action buttons.
Source code in src/nuiitivet/material/date_picker.py
1972 1973 1974 1975 1976 1977 1978 1979 1980 1981 1982 1983 1984 1985 1986 1987 1988 1989 1990 1991 1992 1993 1994 1995 1996 1997 1998 1999 2000 2001 2002 2003 2004 2005 2006 2007 2008 2009 2010 2011 2012 2013 2014 2015 2016 2017 2018 2019 2020 2021 2022 2023 2024 2025 2026 2027 2028 2029 2030 2031 2032 2033 2034 2035 2036 2037 2038 2039 2040 2041 2042 2043 2044 2045 2046 2047 2048 | |
ModalDateRangePicker
¶
ModalDateRangePicker(*, init_value: Optional[Tuple[date, date]] = None, supporting_text: str = 'Select range', min_date: Optional[date] = None, max_date: Optional[date] = None, style: Optional['ModalDateRangePickerStyle'] = None, key: Optional[str] = None)
Bases: ComposableWidget, OverlayAware[Optional[Tuple[date, date]]]
Material Design 3 Modal Date Range Picker.
Allows the user to select a start and end date via two sequential taps.
When shown via overlay.dialog(ModalDateRangePicker(...)), the returned
:class:OverlayHandle resolves to (start, end) on confirmation or
None on cancellation::
result = await overlay.dialog(ModalDateRangePicker())
if result.value is not None:
start, end = result.value
MD3 container: 360×524dp, Extra large corner rounding (28dp).
Range selection flow
- First tap sets the start date.
- Second tap sets the end date (must be ≥ start; tapping before the start resets and begins a new selection from that date).
.. note::
Experimental implementation. This class does not yet fully comply with the
MD3 Expressive specification. Known limitations: the icon button that toggles
between :class:ModalDateRangePicker and a range-input variant
(ModalDateRangeInput) is not implemented, and ModalDateRangeInput
does not yet exist.
Deferred: Nuiitivet prioritizes the Docked variant as a desktop-oriented
framework.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
init_value
|
Optional[Tuple[date, date]]
|
Pre-selected date range as |
None
|
supporting_text
|
str
|
Small label shown at the top of the header (14pt). |
'Select range'
|
min_date
|
Optional[date]
|
Earliest selectable date. |
None
|
max_date
|
Optional[date]
|
Latest selectable date. |
None
|
style
|
Optional['ModalDateRangePickerStyle']
|
Visual style. Defaults to :class: |
None
|
Initialize ModalDateRangePicker.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
init_value
|
Optional[Tuple[date, date]]
|
Initial date range as (start, end) tuple. |
None
|
supporting_text
|
str
|
Small label shown at the top of the header (14pt). |
'Select range'
|
min_date
|
Optional[date]
|
Minimum selectable date. |
None
|
max_date
|
Optional[date]
|
Maximum selectable date. |
None
|
style
|
Optional['ModalDateRangePickerStyle']
|
Optional style override. |
None
|
key
|
Optional[str]
|
Stable widget identity for dev-bridge targeting and hot reload. |
None
|
Source code in src/nuiitivet/material/date_picker.py
build
¶
build() -> Widget
Build the modal range picker with header, calendar (or year grid), and action buttons.
Source code in src/nuiitivet/material/date_picker.py
2242 2243 2244 2245 2246 2247 2248 2249 2250 2251 2252 2253 2254 2255 2256 2257 2258 2259 2260 2261 2262 2263 2264 2265 2266 2267 2268 2269 2270 2271 2272 2273 2274 2275 2276 2277 2278 2279 2280 2281 2282 2283 2284 2285 2286 2287 2288 2289 2290 2291 2292 2293 2294 2295 2296 2297 2298 2299 2300 2301 2302 2303 2304 2305 2306 2307 2308 2309 2310 2311 2312 2313 2314 2315 2316 2317 2318 2319 | |
ModalDateInput
¶
ModalDateInput(*, init_value: Optional[date] = None, supporting_text: str = 'Enter date', input_label: str = 'Date', date_format: DateFormat = DEFAULT_DATE_FORMAT, min_date: Optional[date] = None, max_date: Optional[date] = None, style: Optional['ModalDateInputStyle'] = None, key: Optional[str] = None)
Bases: ComposableWidget, OverlayAware[Optional[date]]
Material Design 3 Modal Date Input.
Allows the user to type a date directly into a text field. When shown via
overlay.dialog(ModalDateInput(...)), the returned
:class:OverlayHandle resolves to the entered date on confirmation or
None on cancellation::
result = await overlay.dialog(ModalDateInput())
if result.value is not None:
entered: datetime.date = result.value
MD3 container: 328×512dp, Extra large corner rounding (28dp).
.. note::
Experimental implementation. This class does not yet fully comply with the
MD3 Expressive specification. Known limitations: the icon button that toggles
between :class:ModalDateInput and :class:ModalDatePicker is not implemented,
and the range-input variant (ModalDateRangeInput) does not yet exist.
Deferred: Nuiitivet prioritizes the Docked variant as a desktop-oriented
framework.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
init_value
|
Optional[date]
|
Optional initial date used to pre-populate the text field. |
None
|
supporting_text
|
str
|
Small label shown at the top of the header (14pt). |
'Enter date'
|
input_label
|
str
|
Label for the date text field. |
'Date'
|
date_format
|
DateFormat
|
How the typed date is read and rendered. Its pattern is also the hint shown below the field. |
DEFAULT_DATE_FORMAT
|
min_date
|
Optional[date]
|
Earliest acceptable date. |
None
|
max_date
|
Optional[date]
|
Latest acceptable date. |
None
|
style
|
Optional['ModalDateInputStyle']
|
Visual style. Defaults to :class: |
None
|
Initialize ModalDateInput.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
init_value
|
Optional[date]
|
Initial date to pre-populate the text field. |
None
|
supporting_text
|
str
|
Small label shown at the top of the header (14pt). |
'Enter date'
|
input_label
|
str
|
Text field label. |
'Date'
|
date_format
|
DateFormat
|
How the typed date is read and rendered. |
DEFAULT_DATE_FORMAT
|
min_date
|
Optional[date]
|
Minimum acceptable date. |
None
|
max_date
|
Optional[date]
|
Maximum acceptable date. |
None
|
style
|
Optional['ModalDateInputStyle']
|
Optional style override. |
None
|
key
|
Optional[str]
|
Stable widget identity for dev-bridge targeting and hot reload. |
None
|
Source code in src/nuiitivet/material/date_picker.py
on_mount
¶
Subscribe to text changes to keep the header date display in sync.
build
¶
build() -> Widget
Build the modal date input with header, text field, and action buttons.
Source code in src/nuiitivet/material/date_picker.py
2456 2457 2458 2459 2460 2461 2462 2463 2464 2465 2466 2467 2468 2469 2470 2471 2472 2473 2474 2475 2476 2477 2478 2479 2480 2481 2482 2483 2484 2485 2486 2487 2488 2489 2490 2491 2492 2493 2494 2495 2496 2497 2498 2499 2500 2501 2502 2503 2504 2505 2506 2507 2508 2509 2510 2511 2512 2513 2514 2515 2516 2517 2518 2519 2520 2521 2522 2523 2524 2525 2526 2527 2528 2529 2530 2531 2532 2533 2534 2535 2536 2537 2538 2539 2540 2541 2542 2543 2544 2545 2546 2547 2548 2549 2550 2551 2552 2553 2554 2555 | |
DateFormat
¶
How a date is written as text, and read back.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
pattern
|
str
|
The format dates are rendered in, and the first one accepted
when parsing. Also what :meth: |
'mm/dd/yyyy'
|
also_accepts
|
Sequence[str]
|
Further patterns accepted when parsing, tried in order
after pattern. Typing is worth being lenient about -- someone will
enter |
()
|
Raises:
| Type | Description |
|---|---|
ValueError
|
If any pattern is malformed. See :func: |
Initialize DateFormat.
Source code in src/nuiitivet/material/date_format.py
parse
¶
Read text as a date.
A bound method, so it can be handed straight to an operator::
self.arrival = self.arrival_text.map(fmt.parse)
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
text
|
str
|
Raw user input. Surrounding whitespace is ignored. |
required |
Returns:
| Type | Description |
|---|---|
Optional[date]
|
The date, or |
Optional[date]
|
which includes empty and half-typed text. |
Source code in src/nuiitivet/material/date_format.py
format
¶
Render value in :attr:pattern, or "" when unset.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
value
|
Optional[date]
|
The date to render, or |
required |
Returns:
| Type | Description |
|---|---|
str
|
Text that :meth: |
Source code in src/nuiitivet/material/date_format.py
matches
¶
Whether :meth:parse can read text.
The predicate form, for the filter() step of a derived date::
self.arrival = self.arrival_text.filter(fmt.matches, initial="").map(fmt.parse)
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
text
|
str
|
Raw user input. |
required |
Returns:
| Type | Description |
|---|---|
bool
|
|
Source code in src/nuiitivet/material/date_format.py
CalendarLabels
dataclass
¶
CalendarLabels(month_names: Tuple[str, ...] = ('January', 'February', 'March', 'April', 'May', 'June', 'July', 'August', 'September', 'October', 'November', 'December'), weekday_labels: Tuple[str, ...] = ('M', 'T', 'W', 'T', 'F', 'S', 'S'), first_day_of_week: int = SUNDAY)
Names and week convention a calendar renders dates with.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
month_names
|
Tuple[str, ...]
|
Twelve month names, January first, indexed by
|
('January', 'February', 'March', 'April', 'May', 'June', 'July', 'August', 'September', 'October', 'November', 'December')
|
weekday_labels
|
Tuple[str, ...]
|
Seven weekday column headers, Monday first -- indexed
by :meth: |
('M', 'T', 'W', 'T', 'F', 'S', 'S')
|
first_day_of_week
|
int
|
The weekday the grid's first column shows, numbered
as :meth: |
SUNDAY
|
Raises:
| Type | Description |
|---|---|
ValueError
|
If month_names does not hold 12 entries, weekday_labels does not hold 7, or first_day_of_week is outside 0-6. |
weekday_columns
¶
The weekday headers in grid column order.
Returns:
| Type | Description |
|---|---|
Tuple[str, ...]
|
The seven labels starting at :attr: |
Source code in src/nuiitivet/material/calendar_labels.py
DatePickerStyle
dataclass
¶
DatePickerStyle(background: ColorSpec = SURFACE_CONTAINER_HIGH, elevation: int = 3, corner_radius: float = 16.0, container_width: float = 360.0, container_height: float = 460.0, date_cell_size: int = 40, date_cell_radius: float = 20.0, state_layer_size: int = 40, date_font_size: int = 16, date_selected_background: ColorSpec = PRIMARY, date_selected_text: ColorSpec = ON_PRIMARY, date_today_outline_color: ColorSpec = PRIMARY, date_today_text: ColorSpec = PRIMARY, date_unselected_text: ColorSpec = ON_SURFACE, date_outside_month_opacity: float = 0.38, weekday_text: ColorSpec = ON_SURFACE, range_active_indicator_background: ColorSpec = SECONDARY_CONTAINER, range_date_in_range_text: ColorSpec = ON_SECONDARY_CONTAINER, header_height: float = 64.0, header_headline_color: ColorSpec = ON_SURFACE_VARIANT, header_supporting_text_color: ColorSpec = ON_SURFACE_VARIANT, hover_state_layer_opacity: float = 0.08, focus_state_layer_opacity: float = 0.1, pressed_state_layer_opacity: float = 0.1, header_supporting_text_font_size: float = 14.0, header_headline_font_size: float = 32.0, menu_button_height: float = 40.0, menu_button_font_size: int = 14, menu_button_icon_size: int = 18, menu_button_text: ColorSpec = ON_SURFACE_VARIANT, menu_list_item_height: float = 48.0, menu_list_item_selected_background: ColorSpec = SECONDARY_CONTAINER, menu_list_item_text: ColorSpec = ON_SURFACE, menu_list_item_selected_text: ColorSpec = ON_SECONDARY_CONTAINER)
Bases: CalendarStyle
Style for :class:DatePicker (inline calendar).
MD3 calendar: 360×460dp container, Large corner rounding (16dp). Adds the month/year inline list-menu tokens to the shared calendar base.
DockedDatePickerStyle
dataclass
¶
DockedDatePickerStyle(calendar: DatePickerStyle = DatePickerStyle(), field_width: float = 360.0, dropdown_gap: float = 4.0)
Style for :class:DockedDatePicker (text field + anchored calendar).
Composes — rather than inherits — a :class:DatePickerStyle for the
dropdown calendar, keeping the calendar tokens separate from the text-field
and dropdown tokens.
copy_with
¶
Return a new style with the given fields overridden.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
**changes
|
Any
|
Fields to override. |
{}
|
Returns:
| Type | Description |
|---|---|
'DockedDatePickerStyle'
|
New |
Source code in src/nuiitivet/material/styles/date_picker_style.py
ModalDatePickerStyle
dataclass
¶
ModalDatePickerStyle(background: ColorSpec = SURFACE_CONTAINER_HIGH, elevation: int = 3, corner_radius: float = 28.0, container_width: float = 360.0, container_height: float = 524.0, date_cell_size: int = 40, date_cell_radius: float = 20.0, state_layer_size: int = 40, date_font_size: int = 16, date_selected_background: ColorSpec = PRIMARY, date_selected_text: ColorSpec = ON_PRIMARY, date_today_outline_color: ColorSpec = PRIMARY, date_today_text: ColorSpec = PRIMARY, date_unselected_text: ColorSpec = ON_SURFACE, date_outside_month_opacity: float = 0.38, weekday_text: ColorSpec = ON_SURFACE, range_active_indicator_background: ColorSpec = SECONDARY_CONTAINER, range_date_in_range_text: ColorSpec = ON_SECONDARY_CONTAINER, header_height: float = 120.0, header_headline_color: ColorSpec = ON_SURFACE_VARIANT, header_supporting_text_color: ColorSpec = ON_SURFACE_VARIANT, hover_state_layer_opacity: float = 0.08, focus_state_layer_opacity: float = 0.1, pressed_state_layer_opacity: float = 0.1, header_supporting_text_font_size: float = 14.0, header_headline_font_size: float = 32.0, menu_button_height: float = 40.0, menu_button_font_size: int = 14, menu_button_icon_size: int = 18, menu_button_text: ColorSpec = ON_SURFACE_VARIANT, year_chip_width: float = 72.0, year_chip_height: float = 36.0, year_chip_radius: float = 18.0, year_chip_gap: int = 30, year_chip_selected_background: ColorSpec = PRIMARY, year_chip_selected_text: ColorSpec = ON_PRIMARY, year_chip_unselected_text: ColorSpec = ON_SURFACE_VARIANT)
Bases: CalendarStyle
Style for :class:ModalDatePicker (single-date dialog).
MD3 modal picker: 360×524dp container, Extra-large corner rounding (28dp). Adds the year-chip selection tokens to the shared calendar base.
ModalDateRangePickerStyle
dataclass
¶
ModalDateRangePickerStyle(background: ColorSpec = SURFACE_CONTAINER_HIGH, elevation: int = 3, corner_radius: float = 28.0, container_width: float = 360.0, container_height: float = 524.0, date_cell_size: int = 40, date_cell_radius: float = 20.0, state_layer_size: int = 40, date_font_size: int = 16, date_selected_background: ColorSpec = PRIMARY, date_selected_text: ColorSpec = ON_PRIMARY, date_today_outline_color: ColorSpec = PRIMARY, date_today_text: ColorSpec = PRIMARY, date_unselected_text: ColorSpec = ON_SURFACE, date_outside_month_opacity: float = 0.38, weekday_text: ColorSpec = ON_SURFACE, range_active_indicator_background: ColorSpec = SECONDARY_CONTAINER, range_date_in_range_text: ColorSpec = ON_SECONDARY_CONTAINER, header_height: float = 120.0, header_headline_color: ColorSpec = ON_SURFACE_VARIANT, header_supporting_text_color: ColorSpec = ON_SURFACE_VARIANT, hover_state_layer_opacity: float = 0.08, focus_state_layer_opacity: float = 0.1, pressed_state_layer_opacity: float = 0.1, header_supporting_text_font_size: float = 14.0, header_headline_font_size: float = 32.0, menu_button_height: float = 40.0, menu_button_font_size: int = 14, menu_button_icon_size: int = 18, menu_button_text: ColorSpec = ON_SURFACE_VARIANT, year_chip_width: float = 72.0, year_chip_height: float = 36.0, year_chip_radius: float = 18.0, year_chip_gap: int = 30, year_chip_selected_background: ColorSpec = PRIMARY, year_chip_selected_text: ColorSpec = ON_PRIMARY, year_chip_unselected_text: ColorSpec = ON_SURFACE_VARIANT, range_header_height: float = 128.0, range_headline_font_size: float = 22.0)
Bases: ModalDatePickerStyle
Style for :class:ModalDateRangePicker (date-range dialog).
Extends :class:ModalDatePickerStyle (same calendar, year chips and
container) with the taller range-selection header tokens.
ModalDateInputStyle
dataclass
¶
ModalDateInputStyle(background: ColorSpec = SURFACE_CONTAINER_HIGH, elevation: int = 3, corner_radius: float = 28.0, container_width: float = 328.0, container_height: float = 512.0, header_headline_color: ColorSpec = ON_SURFACE_VARIANT, header_supporting_text_color: ColorSpec = ON_SURFACE_VARIANT, header_supporting_text_font_size: float = 14.0, header_headline_font_size: float = 32.0)
Style for :class:ModalDateInput (text-field date entry dialog).
Independent of the calendar pickers: the date-input dialog is a text-field form, so it shares none of the calendar/selection tokens — only the dialog container and header typography.
MD3 modal input: 328×512dp container, Extra-large corner rounding (28dp).
copy_with
¶
Return a new style with the given fields overridden.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
**changes
|
Any
|
Fields to override. |
{}
|
Returns:
| Type | Description |
|---|---|
'ModalDateInputStyle'
|
New |
Source code in src/nuiitivet/material/styles/date_picker_style.py
Image
¶
Image(source: bytes | None | ObservableBase[bytes | None], *, fit: Fit = 'contain', width: SizingLike = None, height: SizingLike = None, padding: int | tuple[int, int] | tuple[int, int, int, int] = 0, alignment: AlignmentLike = 'center', key: str | None = None)
Bases: Widget
Display a raster image from in-memory bytes.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
source
|
bytes | None | ObservableBase[bytes | None]
|
Encoded image bytes, |
required |
fit
|
Fit
|
Content fit mode. One of |
'contain'
|
alignment
|
AlignmentLike
|
Content alignment in the allocated content rect. |
'center'
|
width
|
SizingLike
|
Width sizing. |
None
|
height
|
SizingLike
|
Height sizing. |
None
|
padding
|
int | tuple[int, int] | tuple[int, int, int, int]
|
Space around content. |
0
|
Initialize an Image widget.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
source
|
bytes | None | ObservableBase[bytes | None]
|
Encoded image bytes, |
required |
fit
|
Fit
|
Content fit mode. One of |
'contain'
|
width
|
SizingLike
|
Width sizing. |
None
|
height
|
SizingLike
|
Height sizing. |
None
|
padding
|
int | tuple[int, int] | tuple[int, int, int, int]
|
Space around content. |
0
|
alignment
|
AlignmentLike
|
Content alignment in the allocated content rect. |
'center'
|
key
|
str | None
|
Stable widget identity for dev-bridge targeting and hot reload. |
None
|
Source code in src/nuiitivet/widgets/image.py
preferred_size
¶
Return preferred size based on intrinsic image size and explicit sizing.
Source code in src/nuiitivet/widgets/image.py
paint
¶
Paint the image into the given rect according to fit and alignment.
Source code in src/nuiitivet/widgets/image.py
elevation_shadows
¶
Return the shadows for the given MD3 elevation level.
The result feeds the shadows() modifier directly::
widget.modifier(nv.shadows(nv.elevation_shadows(2)))
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
level
|
int
|
MD3 elevation level, clamped to the range 0-5. |
required |
Returns:
| Type | Description |
|---|---|
Shadows
|
A tuple of |
Shadows
|
key). Level 0 returns an empty tuple, which draws no shadow. |
Source code in src/nuiitivet/material/theme/elevation.py
parse_date
¶
Read text as a date using :data:DEFAULT_DATE_FORMAT.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
text
|
str
|
Raw user input. |
required |
Returns:
| Type | Description |
|---|---|
Optional[date]
|
The date, or |
Source code in src/nuiitivet/material/date_format.py
format_date
¶
Render value as mm/dd/yyyy, or "" when unset.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
value
|
Optional[date]
|
The date to render, or |
required |
Returns:
| Type | Description |
|---|---|
str
|
Text that :func: |
Source code in src/nuiitivet/material/date_format.py
is_date
¶
Whether :func:parse_date can read text as a date.
Written for the filter() step of a derived date, where the application
wants the last valid date held while the user types an incomplete one::
self.date_text = nv.Observable("")
self.date = self.date_text.filter(nv.is_date, initial="").map(nv.parse_date)
The seed is filtered text, not a date, so it goes through map as well:
initial="" reads back as None until the first valid date arrives.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
text
|
str
|
Raw user input. |
required |
Returns:
| Type | Description |
|---|---|
bool
|
|