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]
|
Insets from the allocated rect to the pill. |
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
|
Insets from the allocated rect to 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
|
Insets from the allocated rect to 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: PaddingLike = 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
|
PaddingLike
|
Insets from the allocated rect to the container. |
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
editable_parameters
classmethod
¶
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, padding: PaddingLike = 0, 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
|
padding
|
PaddingLike
|
Insets from the allocated rect to the container. |
0
|
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
1555 1556 1557 1558 1559 1560 1561 1562 1563 1564 1565 1566 1567 1568 1569 1570 1571 1572 1573 1574 1575 1576 1577 1578 1579 1580 1581 1582 1583 1584 1585 1586 1587 1588 1589 1590 1591 1592 1593 1594 1595 1596 1597 1598 1599 1600 1601 1602 1603 1604 1605 1606 1607 1608 1609 1610 1611 1612 1613 1614 1615 1616 1617 1618 1619 1620 1621 1622 1623 1624 1625 1626 1627 1628 1629 1630 1631 1632 1633 1634 1635 1636 1637 1638 1639 1640 1641 1642 | |
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: PaddingLike = 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
|
PaddingLike
|
Insets from the allocated rect to the container. |
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, padding: PaddingLike = 0, 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
|
padding
|
PaddingLike
|
Insets from the allocated rect to the container. |
0
|
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
style
property
¶
style: ButtonStyle
Return the style in effect: the caller's, else the host's, else the standard preset.
editable_parameters
classmethod
¶
IconToggleButton
¶
IconToggleButton(icon: 'Symbol' | str | ReadOnlyObservableProtocol['Symbol'] | ReadOnlyObservableProtocol[str], *, selected: bool | ObservableProtocol[bool] = False, on_change: Optional[BoolCallback] = None, disabled: bool | ObservableProtocol[bool] = False, padding: PaddingLike = 0, 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
|
padding
|
PaddingLike
|
Insets from the allocated rect to the container. |
0
|
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
editable_parameters
classmethod
¶
style is picked from :class:IconToggleButtonStyle's presets.
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: PaddingLike = 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
|
PaddingLike
|
Insets from the allocated rect to the container. |
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
editable_parameters
classmethod
¶
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, pressed_corner_radius: Optional[int] = None, container_height: int = 40, content_insets: PaddingLike = (16, 0, 16, 0), spacing: int = 8, min_width: Optional[int] = 64, min_height: Optional[int] = None, 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
default
classmethod
¶
default() -> ButtonStyle
Return the framework default, ignoring any theme.
This is what a button renders with before it is mounted, and what a button without a theme falls back to.
Returns:
| Type | Description |
|---|---|
ButtonStyle
|
The filled style at size |
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).
default
classmethod
¶
default() -> ButtonStyle
Return the framework default, ignoring any theme.
This is what an icon button renders with before it is mounted, and what an icon button without a theme falls back to.
Returns:
| Type | Description |
|---|---|
ButtonStyle
|
The standard icon-button style at size |
Source code in src/nuiitivet/material/styles/button_style.py
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.
The unselected style keeps the round container, the selected style the square one; the widget morphs between them.
Presets: :meth:standard, :meth:filled, :meth:outlined, :meth:tonal.
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
default
classmethod
¶
default() -> IconToggleButtonStyle
Return the framework default, 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, pressed_corner_radius: Optional[int] = None, container_height: int = 40, content_insets: PaddingLike = (16, 0, 16, 0), spacing: int = 8, min_width: Optional[int] = 64, min_height: Optional[int] = None, 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 of the :class:Fab widget, with the field set of :class:ButtonStyle.
Presets, each taking a size: :meth:primary, :meth:secondary,
:meth:tertiary (tonal containers), and :meth:primary_solid,
:meth:secondary_solid, :meth:tertiary_solid.
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
default
classmethod
¶
default() -> FabStyle
Return the framework default, 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, selected_corner_radius: int = 12, pressed_corner_radius: Optional[int] = 8, content_insets: PaddingLike = (16, 0, 16, 0), spacing: int = 8, min_width: Optional[int] = 64, min_height: Optional[int] = None, 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 size tokens, the corner radius of each shape
the container takes, and 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.
Presets: :meth:filled, :meth:outlined, :meth:elevated, :meth:tonal.
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
default
classmethod
¶
Return the framework default, 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.
editable_parameters
classmethod
¶
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).
Presets: :meth:elevated, :meth:filled, :meth:outlined.
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
default
classmethod
¶
default() -> CardStyle
Return the framework default, ignoring any theme.
This is what a card renders with before it is mounted, and what
:meth:from_theme falls back to when no Material theme is installed.
Returns:
| Type | Description |
|---|---|
CardStyle
|
The filled card style. |
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]]]
|
Insets from the allocated rect to the container. |
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]]]
|
Insets from the allocated rect to the container. |
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]]]
|
Insets from the allocated rect to the container. |
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]]]
|
Insets from the allocated rect to the container. |
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, padding: PaddingLike = 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.
Initialize BasicDialog.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
title
|
Optional[Union[str, ReadOnlyObservableProtocol[str]]]
|
Title text, or an observable of it. |
None
|
message
|
Optional[Union[str, ReadOnlyObservableProtocol[str]]]
|
Message text, or an observable of it. |
None
|
icon
|
Optional[Union[str, 'Symbol', ReadOnlyObservableProtocol[str], ReadOnlyObservableProtocol['Symbol']]]
|
Icon shown above the title: a |
None
|
actions
|
Optional[List[Widget]]
|
Action widgets, typically |
None
|
style
|
Optional[DialogStyle]
|
Dialog style override; the theme's default when omitted. |
None
|
width
|
float
|
Container width in dp (MD3 range: 280-560). Defaults to 280. |
280.0
|
padding
|
PaddingLike
|
Insets from the allocated rect to the dialog surface. |
0
|
key
|
Optional[str]
|
Stable widget identity for dev-bridge targeting and hot reload. |
None
|
Source code in src/nuiitivet/material/dialogs.py
editable_parameters
classmethod
¶
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.
Initialize the LoadingIndicator.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
size
|
int
|
Outer size of the indicator; sets both width and height. |
48
|
padding
|
Optional[Tuple[int, int, int, int] | Tuple[int, int] | int]
|
Insets from the allocated rect to 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
editable_parameters
classmethod
¶
style is picked from :class:LoadingIndicatorStyle's presets.
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
|
Insets from the allocated rect to 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
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
|
Insets from the allocated rect to 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
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
|
Insets from the allocated rect to 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.
editable_parameters
classmethod
¶
style is picked from :class:LinearProgressIndicatorStyle's presets.
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
|
Insets from the allocated rect to 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.
editable_parameters
classmethod
¶
style is picked from :class:LinearProgressIndicatorStyle's presets.
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, padding: PaddingLike = 0, 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
|
padding
|
PaddingLike
|
Insets from the allocated rect to the menu surface. |
0
|
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
¶
The style in effect: the caller's or the parent menu's, else the theme's, with the MD3 baseline numbers.
editable_parameters
classmethod
¶
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, padding: PaddingLike = 0, 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
|
padding
|
PaddingLike
|
Insets from the allocated rect to the item. |
0
|
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, padding: PaddingLike = 0, 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
|
padding
|
PaddingLike
|
Insets from the allocated rect to the item. |
0
|
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, padding: PaddingLike = 0, 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
|
padding
|
PaddingLike
|
Insets from the allocated rect to the FAB footprint. |
0
|
key
|
Optional[str]
|
Stable widget identity for dev-bridge targeting and hot reload. |
None
|
Source code in src/nuiitivet/material/fab_menu.py
454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 | |
is_open
property
¶
is_open: Observable[bool]
Observable that controls (and reflects) the menu's open state.
editable_parameters
classmethod
¶
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.
Attributes:
| Name | Type | Description |
|---|---|---|
icon |
IconLike
|
Leading icon shown in the menu-item pill. |
label |
LabelLike
|
Text label rendered next to the icon. |
on_click |
Optional[VoidCallback]
|
Optional callback invoked when the item is selected. |
disabled |
Union[bool, ObservableProtocol[bool]]
|
Whether the item is disabled (non-interactive). |
LoadingIntent
dataclass
¶
Intent for showing a loading indicator via MaterialOverlay.
This is a marker intent with no parameters.
Replace the indicator through the intents of the window's MaterialOverlay.
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.
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]
|
Insets from the allocated rect to the glyph. |
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
453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 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 | |
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
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 1056 1057 1058 1059 1060 1061 1062 1063 1064 | |
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 Material Design 3 checkbox.
Initialize Checkbox.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
checked
|
bool | ObservableProtocol[bool] | ObservableProtocol[Optional[bool]]
|
Checked state, or the observable holding it. An observable
of |
False
|
on_toggle
|
Optional[Callable[[Optional[bool]], None]]
|
Callback invoked with the new state when toggled. |
None
|
indeterminate
|
bool | ObservableProtocol[bool]
|
Whether the checkbox shows the indeterminate mark, or an observable of it, kept apart from a two-state checked. |
False
|
disabled
|
bool | ObservableProtocol[bool]
|
Whether the checkbox ignores interaction, or an observable of it. |
False
|
padding
|
Optional[Union[int, Tuple[int, int], Tuple[int, int, int, int]]]
|
Insets from the allocated rect to the touch target. |
None
|
style
|
Optional['CheckboxStyle']
|
Visual style; the theme's checkbox 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
105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 | |
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
393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 | |
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]]]
|
Insets from the allocated rect to 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
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 903 904 905 906 907 908 | |
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, padding: PaddingLike = 0, 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
|
padding
|
PaddingLike
|
Insets from the allocated rect to the group. |
0
|
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]]]
|
Insets from the allocated rect to the touch target. |
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
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 | |
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 Material Design 3 text field; style picks filled or outlined.
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.
For a field that takes several lines: multiline.
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. Shift+Enter never submits. |
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 -- see
:mod: |
None
|
label
|
str | ReadOnlyObservableProtocol[str] | None
|
Floating label text. A filled field shorter than 52dp shows it only while the field is empty. |
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. With it the icon is a standard icon button -- hover, focus and pressed feedback, keyboard focusable; without it the icon is a plain glyph. |
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; the icon changes as for on_tap_leading_icon. |
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]]
|
Insets from the allocated rect to the field container. |
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
124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 | |
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.
style
property
¶
style: TextFieldStyle
The style in effect: the caller's, else the theme's, else the default, with the MD3 baseline numbers.
is_multiline
property
¶
Whether the field takes several lines, as built by multiline.
max_lines
property
¶
Lines shown before the field scrolls; None is unbounded.
editable_parameters
classmethod
¶
multiline
classmethod
¶
multiline(value: Union[str, ReadOnlyObservableProtocol[str]] = '', *, min_lines: int = 1, max_lines: Optional[int] = 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, 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, 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) -> 'TextField'
A text field that takes several lines.
The text wraps at the width. Shift+Enter breaks the line; Enter submits through on_submit and does nothing without one. The field shows min_lines lines when the text has fewer, grows a line at a time up to max_lines, and then scrolls the caret's line into view. The first row is laid out as a single-line field: the resting label and the icons sit there.
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. |
''
|
min_lines
|
int
|
Lines shown when the text has fewer, at least 1. |
1
|
max_lines
|
Optional[int]
|
Lines shown before the field scrolls, at least
min_lines; |
None
|
on_change
|
Optional[Callable[[str], None]]
|
Callback invoked with the text as it changes, for a side effect of the change. Not during an IME composition. |
None
|
on_submit
|
Optional[Callable[[str], None]]
|
Callback invoked with the text on a bare Enter, on every press, 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, a line
break included: |
None
|
label
|
str | ReadOnlyObservableProtocol[str] | None
|
Floating label text. A filled field shorter than 52dp shows it only while the field is empty. |
None
|
leading_icon
|
Symbol | str | ReadOnlyObservableProtocol[Symbol] | ReadOnlyObservableProtocol[str] | None
|
Icon displayed before the text, in the first row. |
None
|
on_tap_leading_icon
|
Optional[Callable[[], None]]
|
Callback invoked when the leading icon is tapped; with it the icon is a standard icon button. |
None
|
trailing_icon
|
Symbol | str | ReadOnlyObservableProtocol[Symbol] | ReadOnlyObservableProtocol[str] | None
|
Icon displayed after the text, in the first row. |
None
|
on_tap_trailing_icon
|
Optional[Callable[[], None]]
|
Callback invoked when the trailing icon is tapped; the icon changes as for on_tap_leading_icon. |
None
|
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. |
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]]
|
Insets from the allocated rect to the field container. |
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
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 | |
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, container_height: int = 56, content_insets: Tuple[int, int, int, int] = (16, 16, 16, 16), density: Optional[int] = None)
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
¶
default
classmethod
¶
Return the framework default, ignoring any theme.
This is what a text field renders with before it is mounted, and
what :meth:from_theme falls back to when no Material theme is
installed.
Returns:
| Type | Description |
|---|---|
'TextFieldStyle'
|
The filled text field style. |
Source code in src/nuiitivet/material/styles/text_field_style.py
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, padding: PaddingLike = 0, 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.
Initialize DockedSearchBar.
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
|
padding
|
PaddingLike
|
Insets from the allocated rect to the box. |
0
|
style
|
Optional[DockedSearchBarStyle]
|
Custom style configuration. |
None
|
key
|
Optional[str]
|
Stable widget identity for dev-bridge targeting and hot reload. |
None
|
Source code in src/nuiitivet/material/search.py
784 785 786 787 788 789 790 791 792 793 794 795 796 797 798 799 800 801 802 803 804 805 806 807 808 809 810 811 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 | |
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, padding: PaddingLike = 0, 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.
Initialize SearchBar.
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
|
padding
|
PaddingLike
|
Insets from the allocated rect to the box. |
0
|
style
|
Optional[SearchBarStyle]
|
Custom style configuration. |
None
|
key
|
Optional[str]
|
Stable widget identity for dev-bridge targeting and hot reload. |
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, density: Optional[int] = None, 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, icon_target: float = 48.0, 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, 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-compliant).
Attributes:
| Name | Type | Description |
|---|---|---|
default_size |
int
|
Icon size in dp when the widget gives none. |
family |
str
|
Material Symbols family: "outlined", "rounded", "sharp", or "icons" for the legacy Material Icons font. |
color |
ColorSpec
|
Glyph color. |
font_family_priority |
Tuple[str, ...]
|
Font families tried in order for the glyph. |
custom_font_family |
Optional[str]
|
Icon font registered with :meth: |
style_to_family |
dict[str, str]
|
Font family for each family value; filled in on construction. |
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_VARIANT, selected_background: ColorSpec = SECONDARY_CONTAINER, selected_foreground: ColorSpec = ON_SECONDARY_CONTAINER, container_height: int = 64, content_insets: tuple[int, int, int, int] = (16, 0, 16, 0), item_gap: int = 8, fab_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.
Presets: :meth:standard, :meth:vibrant. The *_style methods
derive the styles a toolbar pushes onto the buttons it hosts.
Attributes:
| Name | Type | Description |
|---|---|---|
color_scheme |
ToolbarColorScheme
|
Toolbar color scheme variant. |
background |
ColorSpec
|
Toolbar container background color. |
foreground |
ColorSpec
|
Icon and label color of the toolbar's buttons. |
selected_background |
ColorSpec
|
Container color of a selected toggle button. |
selected_foreground |
ColorSpec
|
Icon and label color of a selected toggle button. |
container_height |
int
|
Visual container height in pixels. |
content_insets |
tuple[int, int, int, int]
|
Internal content insets. |
item_gap |
int
|
Gap between action buttons. |
fab_gap |
int
|
Gap between a floating toolbar and the FAB beside it. |
corner_radius |
int
|
Container corner radius in pixels. |
border_color |
Optional[ColorSpec]
|
Optional border color. |
border_width |
float
|
Border width in pixels. |
elevation |
float
|
Elevation level for shadow rendering. |
copy_with
¶
fab_style
¶
Return the style of a FAB placed beside a floating toolbar of this scheme.
The colour follows :attr:color_scheme: secondary-container for
standard, tertiary-container for vibrant. The elevation is
level 1 at size "s" and level 2 otherwise, one level higher while
hovered.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
size
|
FabSize
|
FAB size. MD3 pairs a floating toolbar with |
's'
|
Returns:
| Type | Description |
|---|---|
FabStyle
|
The derived FAB style. |
Source code in src/nuiitivet/material/styles/toolbar_style.py
icon_button_style
¶
icon_button_style() -> ButtonStyle
Return the style of an icon button hosted by a toolbar of this scheme.
The container shows the toolbar through; the icon and the state layer
take :attr:foreground.
Returns:
| Type | Description |
|---|---|
ButtonStyle
|
The derived icon button style at size |
Source code in src/nuiitivet/material/styles/toolbar_style.py
icon_toggle_button_style
¶
icon_toggle_button_style() -> IconToggleButtonStyle
Return the style pair of an icon toggle button hosted by a toolbar of this scheme.
Unselected is :meth:icon_button_style; selected takes
:attr:selected_background and :attr:selected_foreground.
Returns:
| Type | Description |
|---|---|
IconToggleButtonStyle
|
The derived icon toggle style at size |
Source code in src/nuiitivet/material/styles/toolbar_style.py
button_style
¶
button_style() -> ButtonStyle
Return the style of a text button hosted by a toolbar of this scheme.
The container shows the toolbar through; the label, icon and state
layer take :attr:foreground.
Returns:
| Type | Description |
|---|---|
ButtonStyle
|
The derived button style at size |
Source code in src/nuiitivet/material/styles/toolbar_style.py
toggle_button_style
¶
toggle_button_style() -> ToggleButtonStyle
Return the style of a text toggle button hosted by a toolbar of this scheme.
Unselected matches :meth:button_style; selected takes
:attr:selected_background and :attr:selected_foreground.
Returns:
| Type | Description |
|---|---|
ToggleButtonStyle
|
The derived toggle button style at size |
Source code in src/nuiitivet/material/styles/toolbar_style.py
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
default
classmethod
¶
Return the framework default 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.
Presets: :meth:default (wavy), :meth:flat.
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.
Presets: :meth:default (wavy), :meth:flat.
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.
Initialize Snackbar.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
message
|
str
|
Text to display. |
required |
padding
|
Optional[Union[int, Tuple[int, int, int, int]]]
|
Insets from the allocated rect to the container. |
None
|
style
|
Optional[SnackbarStyle]
|
Visual 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/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.
FormFactor
dataclass
¶
The component sizes of one kind of device.
Colors, shapes, motion and font sizes do not depend on it. A density step
takes 4dp off a component's height. A step below the component's lowest
stops there. A style's own density wins over the step set here.
Button, IconButton, ToggleButton, ButtonGroup, SplitButton and Fab take
their height from their size ("xs" to "xl") only. Dialog, Snackbar,
the date picker surface, Tooltip, Sheet, NavigationRail and Toolbar do not
change with the form factor.
Built-in form factors: :meth:desktop, :meth:mobile.
Attributes:
| Name | Type | Description |
|---|---|---|
touch_targets |
bool
|
Whether a control smaller than 48dp reserves a 48dp touch target. Applies to Button, IconButton, ToggleButton, Chip, Checkbox, RadioButton, Switch and the SearchBar icons. |
text_field |
int
|
Density step of TextField. The lowest is -5. A filled field below 52dp shows its label only while empty. |
search_bar |
int
|
Density step of SearchBar. The lowest is -4. |
menu |
int
|
Density step of a menu item. The lowest is -3. |
copy_with
¶
desktop
classmethod
¶
mobile
classmethod
¶
of
classmethod
¶
Return value as a :class:FormFactor.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
value
|
'FormFactorLike'
|
A form factor or the name of a built-in one. |
required |
Raises:
| Type | Description |
|---|---|
ValueError
|
If |
Source code in src/nuiitivet/material/theme/form_factor.py
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]]
|
Insets from the allocated rect to 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: Widget | None = None, *, transition: TransitionSpec | None = None, layer_composer: NavigationLayerComposer | None = None, key: str | None = None)
Bases: Navigator
Navigator whose screens default to the Material page transition.
It also paints transitions with the Material layer composer, so
:meth:Navigator.routes and :meth:Navigator.intents animate too.
Initialize a MaterialNavigator with a single initial screen.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
screen
|
Widget | None
|
The initial screen. |
None
|
transition
|
TransitionSpec | None
|
The transition |
None
|
layer_composer
|
NavigationLayerComposer | None
|
Optional custom layer composer. |
None
|
key
|
str | None
|
Stable widget identity for dev-bridge targeting and hot reload. |
None
|
Source code in src/nuiitivet/material/navigator.py
Overlay
¶
Overlay(*, intent_resolver: IntentResolver | None = None, intents: Mapping[type[Any], Callable[[Any], Widget]] | 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: |
OverlayHandle[Any]
|
intent stays open across a hot reload, and the handle follows it. |
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 | Any, *, side: Literal['right', 'left'] = 'right', dismiss_on_outside_tap: bool = True) -> OverlayHandle[Any]
Display a modal side sheet.
side sets the edge the sheet slides in from, its alignment, and
which corners are rounded. The rounding uses SideSheet.style.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
sheet
|
Widget | Any
|
A widget containing a :class: |
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
|
Returns:
| Name | Type | Description |
|---|---|---|
An |
OverlayHandle[Any]
|
class: |
OverlayHandle[Any]
|
intent stays open across a hot reload, and the handle follows it. |
Raises:
| Type | Description |
|---|---|
TypeError
|
If the widget, or the one an intent resolves to, contains
no :class: |
Source code in src/nuiitivet/material/overlay.py
bottom_sheet
¶
bottom_sheet(sheet: Widget | Any, *, dismiss_on_outside_tap: bool = True) -> OverlayHandle[Any]
Display a modal bottom sheet sliding up from the bottom edge.
The :class:BottomSheet widget owns the background, size and corner radius.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
sheet
|
Widget | Any
|
A widget containing a :class: |
required |
dismiss_on_outside_tap
|
bool
|
Whether tapping the scrim dismisses the sheet.
Defaults to |
True
|
Returns:
| Name | Type | Description |
|---|---|---|
An |
OverlayHandle[Any]
|
class: |
OverlayHandle[Any]
|
intent stays open across a hot reload, and the handle follows it. |
Raises:
| Type | Description |
|---|---|
TypeError
|
If the widget, or the one an intent resolves to, contains
no :class: |
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, loading and
the sheet methods resolve them through the overlay's intent resolver,
keeping widget construction in the View layer.
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 | Any, *, side: Literal['right', 'left'] = 'right', dismiss_on_outside_tap: bool = True) -> OverlayHandle[Any]
Display a modal side sheet from a widget or an intent.
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, form_factor: Optional[FormFactorLike] = None) -> 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.
form_factor sets the component sizes: "desktop", "mobile" or a
FormFactor. Omitted, it is "desktop".
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, form_factor: Optional[FormFactorLike] = None) -> 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, padding: PaddingLike = 0, key: Optional[str] = None)
Bases: _ToolbarBase
Material Design 3 docked toolbar.
Edge-to-edge by default: padding is 0 unless the caller sets it.
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
|
padding
|
PaddingLike
|
Insets from the allocated rect to the toolbar. |
0
|
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], *, fab: Optional[Fab] = None, 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. An optional FAB sits to the right of the container.
Initialize HorizontalFloatingToolbar.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
buttons
|
Sequence[Widget]
|
Widgets placed inside the toolbar. Prefer |
required |
fab
|
Optional[Fab]
|
FAB placed to the right of the container, |
None
|
padding
|
PaddingLike
|
External padding around the floating toolbar and its FAB. |
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], *, fab: Optional[Fab] = None, 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. An optional FAB sits below the container.
Initialize VerticalFloatingToolbar.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
buttons
|
Sequence[Widget]
|
Widgets placed inside the toolbar. Prefer |
required |
fab
|
Optional[Fab]
|
FAB placed below the container, |
None
|
padding
|
PaddingLike
|
External padding around the floating toolbar and its FAB. |
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, padding: PaddingLike = 0, 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
|
padding
|
PaddingLike
|
Insets from the allocated rect to the tooltip. |
0
|
key
|
str | None
|
Stable widget identity for dev-bridge targeting and hot reload. |
None
|
Source code in src/nuiitivet/material/tooltip_widgets.py
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, padding: PaddingLike = 0, 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
|
padding
|
PaddingLike
|
Insets from the allocated rect to the tooltip. |
0
|
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.
editable_parameters
classmethod
¶
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, padding: PaddingLike = 0, 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.
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 invoked when the Back icon button is pressed. |
None
|
show_back_button
|
Union[bool, ObservableBase[bool]]
|
Whether to show the Back icon button; an
|
False
|
style
|
Optional[SideSheetStyle]
|
Container style. Defaults to :class: |
None
|
padding
|
PaddingLike
|
Insets from the allocated rect to the sheet. |
0
|
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, padding: PaddingLike = 0, 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.
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 size, background and shape. Defaults to
:class: |
None
|
padding
|
PaddingLike
|
Insets from the allocated rect to the sheet. |
0
|
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, padding: PaddingLike = 0, 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.
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 invoked when the close icon button is
pressed. Supplying it disables the default auto-close:
the sheet does not write |
None
|
headline
|
Optional[Union[str, ObservableBase[str]]]
|
Header title (str or Observable[str]). When given, an M3 header row is rendered above content. |
None
|
side
|
Literal['right', 'left']
|
Edge the sheet is attached to ( |
'right'
|
style
|
Optional[StandardSideSheetStyle]
|
Container style. Defaults to :class: |
None
|
padding
|
PaddingLike
|
Insets from the allocated rect to the sheet. |
0
|
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.
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 an observable of either. |
None
|
selected
|
'bool | MutableObservableBase[bool]'
|
Initial selected state, or a writable observable bool bound to external state. |
False
|
on_change
|
Optional[BoolCallback]
|
Callback invoked with the new selected state after
each toggle. In a |
None
|
disabled
|
'bool | MutableObservableBase[bool]'
|
Whether the item ignores pointer events. |
False
|
width
|
SizingLike
|
Width sizing. A fixed value is the item's allocated width
and sits out the pressed-width interaction. A content-fit item
in a |
None
|
style
|
'Optional[ButtonGroupStyle]'
|
Visual style override. When omitted the containing group's style is used; a group button standing on its own follows the theme's standard-group style. |
None
|
key
|
Optional[str]
|
Stable widget identity for dev-bridge targeting and hot reload. |
None
|
Source code in src/nuiitivet/material/button_group.py
102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 | |
preferred_size
¶
preferred_size(max_width: Optional[int] = None, max_height: Optional[int] = None) -> Tuple[int, int]
Return preferred size.
A fixed width is the item's allocated width: no side space is added
on top of it. A content-fit item measures as content plus the reserved
leading and trailing space.
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, padding: PaddingLike = 0, 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.
Initialize StandardButtonGroup.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
items
|
Sequence[GroupButton]
|
Between 2 and 5 |
required |
style
|
'Optional[StandardButtonGroupStyle]'
|
Visual style: |
None
|
padding
|
PaddingLike
|
Insets from the allocated rect to the group. |
0
|
key
|
Optional[str]
|
Stable widget identity for dev-bridge targeting and hot reload. |
None
|
Source code in src/nuiitivet/material/button_group.py
editable_parameters
classmethod
¶
style is picked from :class:StandardButtonGroupStyle's presets.
Source code in src/nuiitivet/material/button_group.py
ConnectedButtonGroup
¶
ConnectedButtonGroup(items: Sequence[GroupButton], *, select_mode: Literal['single', 'multi'] = 'single', style: 'Optional[ConnectedButtonGroupStyle]' = None, padding: PaddingLike = 0, 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.
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: |
None
|
padding
|
PaddingLike
|
Insets from the allocated rect to the group. |
0
|
key
|
Optional[str]
|
Stable widget identity for dev-bridge targeting and hot reload. |
None
|
Source code in src/nuiitivet/material/button_group.py
editable_parameters
classmethod
¶
style is picked from :class:ConnectedButtonGroupStyle's presets.
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
default
classmethod
¶
Return the framework default, 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
default
classmethod
¶
Return the framework default, 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, padding: PaddingLike = 0, 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.default(),
)
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
|
Width sizing. A fixed value or |
None
|
style
|
'Optional[SplitButtonStyle]'
|
Visual style. Defaults to |
None
|
padding
|
PaddingLike
|
Insets from the allocated rect to the button pair. |
0
|
key
|
Optional[str]
|
Stable widget identity for dev-bridge targeting and hot reload. |
None
|
Source code in src/nuiitivet/material/split_button.py
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
default
classmethod
¶
Return the framework default, ignoring any theme.
This is what a split button renders with before it is mounted, and what a split button without a theme falls back to.
Returns:
| Type | Description |
|---|---|
'SplitButtonStyle'
|
The filled split-button style at size |
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, padding: PaddingLike = 0, 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.
Initialize DatePicker.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
value
|
ObservableProtocol[Optional[date]]
|
Observable holding the selected date (or None); the picker reads it and writes each selection into it. |
required |
on_change
|
Optional[Callable[[Optional[date]], None]]
|
Callback invoked after the user selects a date. |
None
|
on_confirm
|
Optional[Callable[[Optional[date]], None]]
|
Callback invoked with the selected date when OK is pressed. When omitted, OK does nothing. |
None
|
on_cancel
|
Optional[Callable[[], None]]
|
Callback invoked when Cancel is pressed. When omitted, Cancel clears value. |
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 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
|
padding
|
PaddingLike
|
Insets from the allocated rect to the picker. |
0
|
key
|
Optional[str]
|
Stable widget identity for dev-bridge targeting and hot reload. |
None
|
Source code in src/nuiitivet/material/date_picker.py
1262 1263 1264 1265 1266 1267 1268 1269 1270 1271 1272 1273 1274 1275 1276 1277 1278 1279 1280 1281 1282 1283 1284 1285 1286 1287 1288 1289 1290 1291 1292 1293 1294 1295 1296 1297 1298 1299 1300 1301 1302 1303 1304 1305 1306 1307 1308 1309 1310 1311 1312 1313 1314 1315 1316 1317 1318 1319 1320 1321 1322 1323 1324 1325 | |
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
1453 1454 1455 1456 1457 1458 1459 1460 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 | |
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, padding: PaddingLike = 0, 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")
The widget reports no errors of its own: half-typed text such as
"06/1" is a normal state, and only the application knows when it is an
error. Derive supporting_text and is_error from the same text.
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.
MD3 reference: md.comp.date-picker.docked.*
Initialize DockedDatePicker.
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 date_format. |
required |
on_change
|
Optional[Callable[[str], None]]
|
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]]
|
Callback invoked with the text when the user presses Enter -- a request to act, not a value settling. |
None
|
on_focus_change
|
Optional[FocusChangeCallback]
|
Callback invoked as focus arrives and leaves. Blur-triggered work belongs here, 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 only decides which month the calendar opens on and which day it highlights, never validates -- unparseable text leaves the calendar where it was. Pass the one the application derives its date with, and they agree. |
DEFAULT_DATE_FORMAT
|
min_date
|
Optional[date]
|
Earliest date selectable in the calendar. |
None
|
max_date
|
Optional[date]
|
Latest date selectable in the calendar. Typing can still produce a date outside the bounds; enforcing a range on typed text is the application's, via is_error. |
None
|
labels
|
CalendarLabels
|
Month names, weekday headers and first day of week of the dropdown calendar. 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; the slot for the
application's error message. For a format hint, pass
|
None
|
is_error
|
bool | ReadOnlyObservableProtocol[bool]
|
Whether to show the field in its error state. It recolors the whole field and is independent of supporting_text. |
False
|
style
|
Optional['DockedDatePickerStyle']
|
Visual style. Defaults to :class: |
None
|
padding
|
PaddingLike
|
Insets from the allocated rect to the field. |
0
|
key
|
Optional[str]
|
Stable widget identity for dev-bridge targeting and hot reload. |
None
|
Source code in src/nuiitivet/material/date_picker.py
1594 1595 1596 1597 1598 1599 1600 1601 1602 1603 1604 1605 1606 1607 1608 1609 1610 1611 1612 1613 1614 1615 1616 1617 1618 1619 1620 1621 1622 1623 1624 1625 1626 1627 1628 1629 1630 1631 1632 1633 1634 1635 1636 1637 1638 1639 1640 1641 1642 1643 1644 1645 1646 1647 1648 1649 1650 1651 1652 1653 1654 1655 1656 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 | |
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, padding: PaddingLike = 0, 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.
Initialize ModalDatePicker.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
init_value
|
Optional[date]
|
Date selected 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
|
padding
|
PaddingLike
|
Insets from the allocated rect to the picker. |
0
|
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
1925 1926 1927 1928 1929 1930 1931 1932 1933 1934 1935 1936 1937 1938 1939 1940 1941 1942 1943 1944 1945 1946 1947 1948 1949 1950 1951 1952 1953 1954 1955 1956 1957 1958 1959 1960 1961 1962 1963 1964 1965 1966 1967 1968 1969 1970 1971 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 | |
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, padding: PaddingLike = 0, 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.
Initialize ModalDateRangePicker.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
init_value
|
Optional[Tuple[date, date]]
|
Range selected when the picker opens, 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
|
padding
|
PaddingLike
|
Insets from the allocated rect to the picker. |
0
|
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
2191 2192 2193 2194 2195 2196 2197 2198 2199 2200 2201 2202 2203 2204 2205 2206 2207 2208 2209 2210 2211 2212 2213 2214 2215 2216 2217 2218 2219 2220 2221 2222 2223 2224 2225 2226 2227 2228 2229 2230 2231 2232 2233 2234 2235 2236 2237 2238 2239 2240 2241 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 | |
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, padding: PaddingLike = 0, 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.
Initialize ModalDateInput.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
init_value
|
Optional[date]
|
Date the text field opens with. |
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. 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
|
padding
|
PaddingLike
|
Insets from the allocated rect to the picker. |
0
|
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
2398 2399 2400 2401 2402 2403 2404 2405 2406 2407 2408 2409 2410 2411 2412 2413 2414 2415 2416 2417 2418 2419 2420 2421 2422 2423 2424 2425 2426 2427 2428 2429 2430 2431 2432 2433 2434 2435 2436 2437 2438 2439 2440 2441 2442 2443 2444 2445 2446 2447 2448 2449 2450 2451 2452 2453 2454 2455 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 | |
DateFormat
¶
How a date is written as text, and read back.
Initialize DateFormat.
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: |
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.
Attributes:
| Name | Type | Description |
|---|---|---|
month_names |
Tuple[str, ...]
|
Twelve month names, January first, indexed by
|
weekday_labels |
Tuple[str, ...]
|
Seven weekday column headers, Monday first -- indexed
by :meth: |
first_day_of_week |
int
|
The weekday the grid's first column shows, numbered
as :meth: |
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.
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]
|
Insets from the allocated rect to the image. |
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
|
|