Material Components¶
High-level widgets implementing Material Design 3.
material
¶
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)
Bases: Box
Large text badge widget.
Initialize LargeBadge.
The height is MD3-fixed (spec) and the width is content-driven, so
neither is a constructor parameter; customize the height via style
(SIZE_POLICY: MD3 fixes the axis -> style only).
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
text
|
str
|
Badge text to display. Must be non-empty. |
required |
padding
|
Union[int, Tuple[int, int], Tuple[int, int, int, int], None]
|
External badge padding. Defaults to style padding. |
None
|
style
|
Optional[LargeBadgeStyle]
|
Optional style override. |
None
|
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)
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
|
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(content: Widget, *, overlay_routes: Mapping[type[Any], Callable[[Any], Route | Widget]] | None = None, width: WindowSizingLike = 'auto', height: WindowSizingLike = 'auto', background: ColorSpec = SURFACE, theme: Optional[Any] = None, title: str | None | ReadOnlyObservableProtocol[str | None] = None, chrome: OSChrome | CustomChrome | None = _UNSET, window_position: WindowPosition | None = None, resizable: bool = True)
Bases: App
Material Design application runner.
This class configures the App with Material Design defaults: - Material Theme (light/dark) - Material Overlay (Dialog, Loading) - Material Background color - Material Navigator (with Material page transitions)
Pass a Widget to use it directly as the root screen (with an implicit
root MaterialNavigator), or pass a Navigator / Navigator.routes(...)
/ Navigator.intents(...) to customize the initial navigation stack.
Initialize a MaterialApp.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
content
|
Widget
|
The root content. Can be a |
required |
overlay_routes
|
Mapping[type[Any], Callable[[Any], Route | Widget]] | None
|
Optional mapping of Intent types to overlay builder functions. |
None
|
width
|
WindowSizingLike
|
Window width specification ("auto", fixed integer, etc.). |
'auto'
|
height
|
WindowSizingLike
|
Window height specification. |
'auto'
|
background
|
ColorSpec
|
Background color of the window. Defaults to Material Surface color. |
SURFACE
|
theme
|
Optional[Any]
|
The MaterialThemeFactory to use. Defaults to Light theme. |
None
|
title
|
str | None | ReadOnlyObservableProtocol[str | None]
|
OS window title. |
None
|
chrome
|
OSChrome | CustomChrome | None
|
Window decoration ( |
_UNSET
|
window_position
|
WindowPosition | None
|
Initial window position. |
None
|
resizable
|
bool
|
Whether the window can be resized. Defaults to True. |
True
|
Source code in src/nuiitivet/material/app.py
HorizontalDivider
¶
HorizontalDivider(*, width: SizingLike = None, padding: PaddingLike = 0, style: Optional[DividerStyle] = None)
Bases: _DividerBase
Material Design 3 horizontal divider.
Draws a full-width line to separate content. Only width is exposed;
the height (thickness) is derived from the style.
Initialize HorizontalDivider.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
width
|
SizingLike
|
Width sizing override. Defaults to |
None
|
padding
|
PaddingLike
|
Padding around the divider line. |
0
|
style
|
Optional[DividerStyle]
|
Optional :class: |
None
|
Source code in src/nuiitivet/material/divider.py
VerticalDivider
¶
VerticalDivider(*, height: SizingLike = None, padding: PaddingLike = 0, style: Optional[DividerStyle] = None)
Bases: _DividerBase
Material Design 3 vertical divider.
Draws a full-height line to separate content. Only height is exposed;
the width (thickness) is derived from the style.
Initialize VerticalDivider.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
height
|
SizingLike
|
Height sizing override. Defaults to |
None
|
padding
|
PaddingLike
|
Padding around the divider line. |
0
|
style
|
Optional[DividerStyle]
|
Optional :class: |
None
|
Source code in src/nuiitivet/material/divider.py
Button
¶
Button(label: str | ReadOnlyObservableProtocol[str] | None = None, icon: 'Symbol' | str | ReadOnlyObservableProtocol['Symbol'] | ReadOnlyObservableProtocol[str] | None = None, *, on_click: Optional[VoidCallback] = None, disabled: bool | ObservableProtocol[bool] = False, width: SizingLike = None, padding: Optional[Union[int, Tuple[int, int, int, int]]] = None, style: Optional[ButtonStyle] = None)
Bases: MaterialButtonBase
Unified Material Design 3 button.
The visual variant (filled, outlined, text, elevated, tonal) and the
M3 size preset ("xs".."xl") are both expressed through the
style argument, which accepts any :class:ButtonStyle instance.
Use the :class:ButtonStyle factory methods to obtain variant presets:
ButtonStyle.filled("s"), ButtonStyle.outlined("m") and so on.
When style is not provided, :meth:ButtonStyle.filled with size
"s" is used as the default.
Initialize Button.
The height is MD3-fixed by the style's size variant, so it is not a
constructor parameter; select it through style (e.g.
ButtonStyle.filled("m")) — SIZE_POLICY: MD3 fixes the axis -> style
only.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
label
|
str | ReadOnlyObservableProtocol[str] | None
|
Text label for the button. |
None
|
icon
|
'Symbol' | str | ReadOnlyObservableProtocol['Symbol'] | ReadOnlyObservableProtocol[str] | None
|
Icon glyph for the button (Symbol, string, or observable). |
None
|
on_click
|
Optional[VoidCallback]
|
Callback invoked when the button is clicked. |
None
|
disabled
|
bool | ObservableProtocol[bool]
|
Whether the button is disabled. |
False
|
width
|
SizingLike
|
Width specification. Defaults to auto. |
None
|
padding
|
Optional[Union[int, Tuple[int, int, int, int]]]
|
Padding override; |
None
|
style
|
Optional[ButtonStyle]
|
Visual style preset. Defaults to |
None
|
Source code in src/nuiitivet/material/buttons.py
ExtendedFab
¶
ExtendedFab(label: str | ReadOnlyObservableProtocol[str], *, icon: 'Symbol' | str | ReadOnlyObservableProtocol['Symbol'] | ReadOnlyObservableProtocol[str] | None = None, on_click: Optional[VoidCallback] = None, expanded: bool | ObservableProtocol[bool] = True, disabled: bool | ObservableProtocol[bool] = False, style: Optional[FabStyle] = None)
Bases: _FabBase
Material Design 3 Extended FAB with a collapse/expand state.
A pill-shaped FAB carrying a required label and an optional leading
icon. The expanded observable morphs the button between the
extended pill (icon + label) and a collapsed circular FAB (icon only).
The width is content-driven when expanded and animates down to the
circular container footprint when collapsed.
When icon is omitted the collapse is a no-op: the button stays a
label pill because there is nothing to show in the circular footprint.
Initialize ExtendedFab.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
label
|
str | ReadOnlyObservableProtocol[str]
|
Required text label (string or observable). |
required |
icon
|
'Symbol' | str | ReadOnlyObservableProtocol['Symbol'] | ReadOnlyObservableProtocol[str] | None
|
Optional leading icon. When present, the collapsed state shows it as a circular FAB; when absent, collapse is a no-op. |
None
|
on_click
|
Optional[VoidCallback]
|
Callback invoked when the button is clicked. |
None
|
expanded
|
bool | ObservableProtocol[bool]
|
Initial expanded state or external observable. |
True
|
disabled
|
bool | ObservableProtocol[bool]
|
Whether the button is disabled. |
False
|
style
|
Optional[FabStyle]
|
FAB style preset selecting the colour mapping and size.
Defaults to :meth: |
None
|
Source code in src/nuiitivet/material/buttons.py
1260 1261 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 1326 1327 1328 1329 1330 1331 1332 1333 1334 1335 1336 1337 1338 1339 1340 1341 1342 1343 1344 1345 1346 1347 | |
expanded
property
writable
¶
Return whether the button is currently expanded (pill) state.
Fab
¶
Fab(icon: 'Symbol' | str | ReadOnlyObservableProtocol['Symbol'] | ReadOnlyObservableProtocol[str], *, on_click: Optional[VoidCallback] = None, disabled: bool | ObservableProtocol[bool] = False, padding: Optional[Union[int, Tuple[int, int, int, int]]] = None, style: Optional[FabStyle] = None)
Bases: _FabBase
Material Design 3 Floating Action Button (FAB).
Initialize Fab.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
icon
|
'Symbol' | str | ReadOnlyObservableProtocol['Symbol'] | ReadOnlyObservableProtocol[str]
|
Icon for the button. |
required |
on_click
|
Optional[VoidCallback]
|
Callback to be invoked when the button is clicked. |
None
|
disabled
|
bool | ObservableProtocol[bool]
|
Whether the button is disabled. |
False
|
padding
|
Optional[Union[int, Tuple[int, int, int, int]]]
|
Padding specification. When |
None
|
style
|
Optional[FabStyle]
|
FAB style preset. Defaults to :meth: |
None
|
Source code in src/nuiitivet/material/buttons.py
IconButton
¶
IconButton(icon: 'Symbol' | str | ReadOnlyObservableProtocol['Symbol'] | ReadOnlyObservableProtocol[str], *, on_click: Optional[VoidCallback] = None, disabled: bool | ObservableProtocol[bool] = False, style: Optional[ButtonStyle] = None)
Bases: MaterialButtonBase
Material icon-only action button driven by style presets.
Initialize IconButton.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
icon
|
'Symbol' | str | ReadOnlyObservableProtocol['Symbol'] | ReadOnlyObservableProtocol[str]
|
Icon glyph source. |
required |
on_click
|
Optional[VoidCallback]
|
Callback invoked when the button is clicked. |
None
|
disabled
|
bool | ObservableProtocol[bool]
|
Whether the button is disabled. |
False
|
style
|
Optional[ButtonStyle]
|
Icon button style preset or custom style. Defaults to
:meth: |
None
|
Source code in src/nuiitivet/material/buttons.py
IconToggleButton
¶
IconToggleButton(icon: 'Symbol' | str | ReadOnlyObservableProtocol['Symbol'] | ReadOnlyObservableProtocol[str], *, selected: bool | ObservableProtocol[bool] = False, on_change: Optional[BoolCallback] = None, disabled: bool | ObservableProtocol[bool] = False, style: Optional[IconToggleButtonStyle] = None)
Bases: ToggleButtonBase
Material icon-only toggle button driven by state-paired styles.
Initialize IconToggleButton.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
icon
|
'Symbol' | str | ReadOnlyObservableProtocol['Symbol'] | ReadOnlyObservableProtocol[str]
|
Icon glyph source. |
required |
selected
|
bool | ObservableProtocol[bool]
|
Selected state value or observable. |
False
|
on_change
|
Optional[BoolCallback]
|
Callback invoked with the new selected state. |
None
|
disabled
|
bool | ObservableProtocol[bool]
|
Whether the button is disabled. |
False
|
style
|
Optional[IconToggleButtonStyle]
|
Toggle style pair for selected and unselected states.
Defaults to :meth: |
None
|
Source code in src/nuiitivet/material/buttons.py
ToggleButton
¶
ToggleButton(label: str | ReadOnlyObservableProtocol[str] | None = None, icon: 'Symbol' | str | ReadOnlyObservableProtocol['Symbol'] | ReadOnlyObservableProtocol[str] | None = None, *, selected: bool | ObservableProtocol[bool] = False, on_change: Optional[BoolCallback] = None, disabled: bool | ObservableProtocol[bool] = False, width: SizingLike = None, padding: Optional[Union[int, Tuple[int, int, int, int]]] = None, style: Optional[ToggleButtonStyle] = None)
Bases: ToggleButtonBase
Unified Material Design 3 toggle button.
Visual variant and size are encoded in a :class:ToggleButtonStyle
which carries both unselected- and selected-state colours. Use
:meth:ToggleButtonStyle.filled, .outlined, .elevated or
.tonal to obtain presets. When style is None, the style
defaults to :meth:ToggleButtonStyle.filled at size "s".
Initialize ToggleButton.
The height is MD3-fixed by the style's size variant, so it is not a
constructor parameter; select it through style (e.g.
ToggleButtonStyle.filled("m")) — SIZE_POLICY: MD3 fixes the axis ->
style only.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
label
|
str | ReadOnlyObservableProtocol[str] | None
|
Text label for the button. |
None
|
icon
|
'Symbol' | str | ReadOnlyObservableProtocol['Symbol'] | ReadOnlyObservableProtocol[str] | None
|
Icon glyph for the button. |
None
|
selected
|
bool | ObservableProtocol[bool]
|
Initial selected state or external observable. |
False
|
on_change
|
Optional[BoolCallback]
|
Callback invoked with the new selected value. |
None
|
disabled
|
bool | ObservableProtocol[bool]
|
Whether the button is disabled. |
False
|
width
|
SizingLike
|
Width specification. |
None
|
padding
|
Optional[Union[int, Tuple[int, int, int, int]]]
|
Padding override; |
None
|
style
|
Optional[ToggleButtonStyle]
|
Toggle style preset. Defaults to |
None
|
Source code in src/nuiitivet/material/buttons.py
ButtonStyle
dataclass
¶
ButtonStyle(background: Optional[ColorSpec] = None, foreground: Optional[ColorSpec] = None, border_color: Optional[ColorSpec] = None, border_width: float = 0.0, corner_radius: int = 20, container_height: int = 40, padding: PaddingLike = (16, 0, 16, 0), spacing: int = 8, min_width: int = 64, min_height: int = 48, label_font_size: int = 14, icon_size: int = 20, elevation: int = 0, overlay_color: Optional[ColorSpec] = None, overlay_alpha: float = 0.0)
Immutable style for the :class:Button widget (M3-compliant).
Use the filled / outlined / text / elevated / tonal
factory classmethods (each accepting a :data:ButtonSize) rather than
constructing directly where possible.
copy_with
¶
copy_with(**changes) -> ButtonStyle
resolve_colors
¶
Resolve :class:ColorRole entries to concrete RGBA values.
Source code in src/nuiitivet/material/styles/button_style.py
resolve
¶
Compatibility resolver returning a dict shaped like the legacy style.
Source code in src/nuiitivet/material/styles/button_style.py
filled
classmethod
¶
filled(size: ButtonSize = 's') -> ButtonStyle
Return the filled-variant style at the given M3 size.
Source code in src/nuiitivet/material/styles/button_style.py
outlined
classmethod
¶
outlined(size: ButtonSize = 's') -> ButtonStyle
Return the outlined-variant style at the given M3 size.
Source code in src/nuiitivet/material/styles/button_style.py
text
classmethod
¶
text(size: ButtonSize = 's') -> ButtonStyle
Return the text-variant style at the given M3 size.
Source code in src/nuiitivet/material/styles/button_style.py
elevated
classmethod
¶
elevated(size: ButtonSize = 's') -> ButtonStyle
Return the elevated-variant style at the given M3 size.
Source code in src/nuiitivet/material/styles/button_style.py
tonal
classmethod
¶
tonal(size: ButtonSize = 's') -> ButtonStyle
Return the tonal-variant style at the given M3 size.
Source code in src/nuiitivet/material/styles/button_style.py
IconButtonStyle
¶
Preset factories for icon-only button styles.
Each factory accepts a :data:ButtonSize argument that drives container
size, icon size, corner radius, and outline width from
:data:ICON_BUTTON_SIZE_TOKENS. Defaults to "s" (40dp).
standard
classmethod
¶
standard(size: ButtonSize = 's') -> ButtonStyle
Return the standard icon-button style at the given M3 size.
Source code in src/nuiitivet/material/styles/button_style.py
filled
classmethod
¶
filled(size: ButtonSize = 's') -> ButtonStyle
Return the filled icon-button style at the given M3 size.
Source code in src/nuiitivet/material/styles/button_style.py
outlined
classmethod
¶
outlined(size: ButtonSize = 's') -> ButtonStyle
Return the outlined icon-button style at the given M3 size.
Source code in src/nuiitivet/material/styles/button_style.py
tonal
classmethod
¶
tonal(size: ButtonSize = 's') -> ButtonStyle
Return the tonal icon-button style at the given M3 size.
Source code in src/nuiitivet/material/styles/button_style.py
vibrant
classmethod
¶
vibrant(size: ButtonSize = 's') -> ButtonStyle
Return the vibrant icon-button style at the given M3 size.
Intended for use on vibrant containers such as a vibrant toolbar.
Source code in src/nuiitivet/material/styles/button_style.py
filled_vibrant
classmethod
¶
filled_vibrant(size: ButtonSize = 's') -> ButtonStyle
Return the filled vibrant icon-button style at the given M3 size.
Source code in src/nuiitivet/material/styles/button_style.py
outlined_vibrant
classmethod
¶
outlined_vibrant(size: ButtonSize = 's') -> ButtonStyle
Return the outlined vibrant icon-button style at the given M3 size.
Source code in src/nuiitivet/material/styles/button_style.py
tonal_vibrant
classmethod
¶
tonal_vibrant(size: ButtonSize = 's') -> ButtonStyle
Return the tonal vibrant icon-button style at the given M3 size.
Source code in src/nuiitivet/material/styles/button_style.py
IconToggleButtonStyle
dataclass
¶
IconToggleButtonStyle(selected: ButtonStyle, unselected: ButtonStyle)
State-paired style for icon toggle button widgets.
standard
classmethod
¶
standard(size: ButtonSize = 's') -> IconToggleButtonStyle
Return styles for the standard icon-toggle button variant.
Source code in src/nuiitivet/material/styles/button_style.py
filled
classmethod
¶
filled(size: ButtonSize = 's') -> IconToggleButtonStyle
Return styles for the filled icon-toggle button variant.
Source code in src/nuiitivet/material/styles/button_style.py
outlined
classmethod
¶
outlined(size: ButtonSize = 's') -> IconToggleButtonStyle
Return styles for the outlined icon-toggle button variant.
Source code in src/nuiitivet/material/styles/button_style.py
tonal
classmethod
¶
tonal(size: ButtonSize = 's') -> IconToggleButtonStyle
Return styles for the tonal icon-toggle button variant.
Source code in src/nuiitivet/material/styles/button_style.py
FabStyle
dataclass
¶
FabStyle(background: Optional[ColorSpec] = None, foreground: Optional[ColorSpec] = None, border_color: Optional[ColorSpec] = None, border_width: float = 0.0, corner_radius: int = 20, container_height: int = 40, padding: PaddingLike = (16, 0, 16, 0), spacing: int = 8, min_width: int = 64, min_height: int = 48, label_font_size: int = 14, icon_size: int = 20, elevation: int = 0, overlay_color: Optional[ColorSpec] = None, overlay_alpha: float = 0.0, focus_opacity: float = 0.1, hover_opacity: float = 0.08, pressed_opacity: float = 0.1, focused_elevation: int = 3, hovered_elevation: int = 4, pressed_elevation: int = 3)
Bases: ButtonStyle
Style preset used by the :class:Fab widget.
Inherits the field set of :class:ButtonStyle so that Fab can reuse
the shared resolve_button_style_params machinery without changes.
primary
classmethod
¶
Return the tonal-primary FAB style at the given size.
Source code in src/nuiitivet/material/styles/fab_style.py
secondary
classmethod
¶
Return the tonal-secondary FAB style at the given size.
Source code in src/nuiitivet/material/styles/fab_style.py
tertiary
classmethod
¶
Return the tonal-tertiary FAB style at the given size.
Source code in src/nuiitivet/material/styles/fab_style.py
primary_solid
classmethod
¶
Return the solid-primary FAB style at the given size.
Source code in src/nuiitivet/material/styles/fab_style.py
secondary_solid
classmethod
¶
Return the solid-secondary FAB style at the given size.
Source code in src/nuiitivet/material/styles/fab_style.py
tertiary_solid
classmethod
¶
Return the solid-tertiary FAB style at the given size.
Source code in src/nuiitivet/material/styles/fab_style.py
ToggleButtonStyle
dataclass
¶
ToggleButtonStyle(container_height: int = 40, corner_radius: int = 20, padding: PaddingLike = (16, 0, 16, 0), spacing: int = 8, min_width: int = 64, min_height: int = 48, label_font_size: int = 14, icon_size: int = 20, border_width: float = 0.0, elevation: int = 0, unselected_background: Optional[ColorSpec] = None, unselected_foreground: Optional[ColorSpec] = None, unselected_border_color: Optional[ColorSpec] = None, unselected_overlay_color: Optional[ColorSpec] = None, unselected_overlay_alpha: float = 0.08, selected_background: Optional[ColorSpec] = None, selected_foreground: Optional[ColorSpec] = None, selected_border_color: Optional[ColorSpec] = None, selected_overlay_color: Optional[ColorSpec] = None, selected_overlay_alpha: float = 0.08)
Immutable style for :class:ToggleButton (M3-compliant).
Stores a single flat set of shape/size tokens plus two paired colour
groups: unselected_* and selected_*. The :meth:for_selected
helper projects the style into a :class:ButtonStyle for the active
state, so the widget internals can reuse the normal Button machinery.
copy_with
¶
for_selected
¶
for_selected(selected: bool) -> ButtonStyle
Project this style into a :class:ButtonStyle for the given state.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
selected
|
bool
|
When |
required |
Source code in src/nuiitivet/material/styles/toggle_button_style.py
filled
classmethod
¶
filled(size: ButtonSize = 's') -> 'ToggleButtonStyle'
Return the filled toggle-button style at the given M3 size.
Source code in src/nuiitivet/material/styles/toggle_button_style.py
outlined
classmethod
¶
outlined(size: ButtonSize = 's') -> 'ToggleButtonStyle'
Return the outlined toggle-button style at the given M3 size.
Source code in src/nuiitivet/material/styles/toggle_button_style.py
elevated
classmethod
¶
elevated(size: ButtonSize = 's') -> 'ToggleButtonStyle'
Return the elevated toggle-button style at the given M3 size.
Source code in src/nuiitivet/material/styles/toggle_button_style.py
tonal
classmethod
¶
tonal(size: ButtonSize = 's') -> 'ToggleButtonStyle'
Return the tonal toggle-button style at the given M3 size.
Source code in src/nuiitivet/material/styles/toggle_button_style.py
Card
¶
Card(child: ChildSpec, *, width: SizingLike = None, height: SizingLike = None, padding: PaddingLike = 0, alignment: AlignmentLike = 'start', style: Optional[CardStyle] = 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
|
Source code in src/nuiitivet/material/card.py
CardStyle
dataclass
¶
CardStyle(background: Optional[ColorSpec] = None, border_color: Optional[ColorSpec] = None, border_width: float = 0.0, border_radius: Union[float, tuple[float, float, float, float]] = 12.0, elevation: int = 0)
Immutable style for Card widgets (M3-compliant).
resolve_colors
¶
Resolve ColorRole to concrete color values.
Source code in src/nuiitivet/material/styles/card_style.py
outlined
classmethod
¶
outlined() -> CardStyle
Create a default style for an outlined card.
Source code in src/nuiitivet/material/styles/card_style.py
from_theme
classmethod
¶
from_theme(theme: Theme) -> CardStyle
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)
Bases: MaterialChipBase
Material Design 3 Assist Chip widget.
Initialize AssistChip.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
label
|
str | ReadOnlyObservableProtocol[str]
|
Chip label. |
required |
leading_icon
|
'Symbol' | str | ReadOnlyObservableProtocol['Symbol'] | ReadOnlyObservableProtocol[str] | None
|
Optional leading icon. |
None
|
on_click
|
Optional[Callable[[], None]]
|
Click callback. |
None
|
disabled
|
bool | ObservableProtocol[bool]
|
Disabled flag. |
False
|
width
|
SizingLike
|
Width sizing. |
None
|
padding
|
Optional[Union[int, Tuple[int, int], Tuple[int, int, int, int]]]
|
External insets around chip widget. |
None
|
style
|
Optional['ChipStyle']
|
Optional chip style. |
None
|
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)
Bases: MaterialChipBase
Material Design 3 Filter Chip widget.
Initialize FilterChip.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
label
|
str | ReadOnlyObservableProtocol[str]
|
Chip label. |
required |
selected
|
bool | ObservableProtocol[bool]
|
Selected state source. |
False
|
on_selected_change
|
Optional[Callable[[bool], None]]
|
Callback when selected state changes. |
None
|
leading_icon
|
'Symbol' | str | ReadOnlyObservableProtocol['Symbol'] | ReadOnlyObservableProtocol[str] | None
|
Optional leading icon in unselected state. |
None
|
on_click
|
Optional[Callable[[], None]]
|
Additional click callback. |
None
|
disabled
|
bool | ObservableProtocol[bool]
|
Disabled flag. |
False
|
width
|
SizingLike
|
Width sizing. |
None
|
padding
|
Optional[Union[int, Tuple[int, int], Tuple[int, int, int, int]]]
|
External insets around chip widget. |
None
|
style
|
Optional['ChipStyle']
|
Optional chip style. |
None
|
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)
Bases: MaterialChipBase
Material Design 3 Input Chip widget.
Initialize InputChip.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
label
|
str | ReadOnlyObservableProtocol[str]
|
Chip label. |
required |
trailing_icon
|
'Symbol' | str | ReadOnlyObservableProtocol['Symbol'] | ReadOnlyObservableProtocol[str]
|
Required trailing icon. |
required |
leading_icon
|
'Symbol' | str | ReadOnlyObservableProtocol['Symbol'] | ReadOnlyObservableProtocol[str] | None
|
Optional leading icon. |
None
|
on_trailing_icon_click
|
Optional[Callable[[], None]]
|
Callback invoked when trailing icon is pressed. |
None
|
on_click
|
Optional[Callable[[], None]]
|
Click callback. |
None
|
disabled
|
bool | ObservableProtocol[bool]
|
Disabled flag. |
False
|
width
|
SizingLike
|
Width sizing. |
None
|
padding
|
Optional[Union[int, Tuple[int, int], Tuple[int, int, int, int]]]
|
External insets around chip widget. |
None
|
style
|
Optional['ChipStyle']
|
Optional chip style. |
None
|
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)
Bases: MaterialChipBase
Material Design 3 Suggestion Chip widget.
Initialize SuggestionChip.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
label
|
str | ReadOnlyObservableProtocol[str]
|
Chip label. |
required |
leading_icon
|
'Symbol' | str | ReadOnlyObservableProtocol['Symbol'] | ReadOnlyObservableProtocol[str] | None
|
Optional leading icon. |
None
|
on_click
|
Optional[Callable[[], None]]
|
Click callback. |
None
|
disabled
|
bool | ObservableProtocol[bool]
|
Disabled flag. |
False
|
width
|
SizingLike
|
Width sizing. |
None
|
padding
|
Optional[Union[int, Tuple[int, int], Tuple[int, int, int, int]]]
|
External insets around chip widget. |
None
|
style
|
Optional['ChipStyle']
|
Optional chip style. |
None
|
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)
Bases: ComposableWidget
Material dialog widget (Basic Dialog).
Displays a modal dialog with optional icon, title, content, and action buttons. Follows Material Design 3 dialog guidelines.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
title
|
Optional[Union[str, ReadOnlyObservableProtocol[str]]]
|
Optional title text (str or Observable). |
None
|
message
|
Optional[Union[str, ReadOnlyObservableProtocol[str]]]
|
Optional message text (str or Observable). |
None
|
icon
|
Optional[Union[str, 'Symbol', ReadOnlyObservableProtocol[str], ReadOnlyObservableProtocol['Symbol']]]
|
Optional icon (str, Symbol, or Observable). |
None
|
actions
|
Optional[List[Widget]]
|
list of action widgets (typically TextButtons). |
None
|
style
|
Optional[DialogStyle]
|
Optional DialogStyle. If None, uses theme default. |
None
|
width
|
float
|
Container width in dp. Per MD3 the basic dialog width is between
|
280.0
|
Initialize BasicDialog.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
title
|
Optional[Union[str, ReadOnlyObservableProtocol[str]]]
|
Optional title text source. |
None
|
message
|
Optional[Union[str, ReadOnlyObservableProtocol[str]]]
|
Optional message text source. |
None
|
icon
|
Optional[Union[str, 'Symbol', ReadOnlyObservableProtocol[str], ReadOnlyObservableProtocol['Symbol']]]
|
Optional icon source. |
None
|
actions
|
Optional[List[Widget]]
|
Optional action widgets (typically buttons). |
None
|
style
|
Optional[DialogStyle]
|
Optional dialog style override. |
None
|
width
|
float
|
Container width in dp (MD3 range: 280-560). Defaults to 280. |
280.0
|
Source code in src/nuiitivet/material/dialogs.py
LoadingIndicator
¶
LoadingIndicator(*, size: int = 48, padding: Optional[Tuple[int, int, int, int] | Tuple[int, int] | int] = 0, style: Optional[LoadingIndicatorStyle] = None)
Bases: Widget
M3 Expressive loading indicator.
This widget is intended for short, indeterminate waits.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
size
|
int
|
Outer size of the indicator (default 48). Sets both width and height. |
48
|
style
|
Optional[LoadingIndicatorStyle]
|
Style configuration for appearance and animation. |
None
|
padding
|
Optional[Tuple[int, int, int, int] | Tuple[int, int] | int]
|
Padding around the indicator. |
0
|
Initialize the LoadingIndicator.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
size
|
int
|
Outer size of the indicator (default 48). |
48
|
padding
|
Optional[Tuple[int, int, int, int] | Tuple[int, int] | int]
|
Padding around the indicator. |
0
|
style
|
Optional[LoadingIndicatorStyle]
|
Style configuration for appearance and animation. |
None
|
Source code in src/nuiitivet/material/loading_indicator.py
CircularProgressIndicator
¶
CircularProgressIndicator(value: float | ObservableProtocol[float] = 0.0, *, disabled: bool | ObservableProtocol[bool] = False, size: int | None = None, padding: PaddingArg = 0, style: CircularProgressIndicatorStyle | None = None)
Bases: _DeterminateProgressBase
Material Design 3 determinate circular progress indicator.
Initialize CircularProgressIndicator.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
value
|
float | ObservableProtocol[float]
|
Progress value in range |
0.0
|
disabled
|
bool | ObservableProtocol[bool]
|
Disabled state. |
False
|
size
|
int | None
|
Outer indicator size in dp. Uses style default when omitted. |
None
|
padding
|
PaddingArg
|
Padding around the indicator. |
0
|
style
|
CircularProgressIndicatorStyle | None
|
Optional style override. |
None
|
Source code in src/nuiitivet/material/progress_indicators.py
style
property
¶
Return effective circular progress indicator style.
IndeterminateCircularProgressIndicator
¶
IndeterminateCircularProgressIndicator(*, disabled: bool | ObservableProtocol[bool] = False, size: int | None = None, padding: PaddingArg = 0, style: CircularProgressIndicatorStyle | None = None)
Bases: _IndeterminateProgressBase
Material Design 3 indeterminate circular progress indicator.
Initialize IndeterminateCircularProgressIndicator.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
disabled
|
bool | ObservableProtocol[bool]
|
Disabled state. |
False
|
size
|
int | None
|
Outer indicator size in dp. Uses style default when omitted. |
None
|
padding
|
PaddingArg
|
Padding around the indicator. |
0
|
style
|
CircularProgressIndicatorStyle | None
|
Optional style override. |
None
|
Source code in src/nuiitivet/material/progress_indicators.py
style
property
¶
Return effective circular progress indicator style.
IndeterminateLinearProgressIndicator
¶
IndeterminateLinearProgressIndicator(*, disabled: bool | ObservableProtocol[bool] = False, width: SizingLike = '1%', padding: PaddingArg = 0, style: LinearProgressIndicatorStyle | 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. |
'1%'
|
padding
|
PaddingArg
|
Padding around the indicator. |
0
|
style
|
LinearProgressIndicatorStyle | None
|
Optional style override. |
None
|
Source code in src/nuiitivet/material/progress_indicators.py
style
property
¶
Return effective linear progress indicator style.
LinearProgressIndicator
¶
LinearProgressIndicator(value: float | ObservableProtocol[float] = 0.0, *, disabled: bool | ObservableProtocol[bool] = False, width: SizingLike = '1%', padding: PaddingArg = 0, style: LinearProgressIndicatorStyle | 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. |
'1%'
|
padding
|
PaddingArg
|
Padding around the indicator. |
0
|
style
|
LinearProgressIndicatorStyle | None
|
Optional style override. |
None
|
Source code in src/nuiitivet/material/progress_indicators.py
style
property
¶
Return effective linear progress indicator style.
Menu
¶
Menu(items: list[MenuItem | SubMenuItem | MenuDivider], *, on_dismiss: Callable[[], None] | None = None, style: MenuStyle | None = None)
Bases: InteractiveWidget
Material Design 3 vertical menu popup surface.
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
|
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)
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
|
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)
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
|
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)
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.light_dismiss.
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
|
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 | |
is_open
property
¶
is_open: Observable[bool]
Observable that controls (and reflects) the menu's open state.
FabMenuItem
dataclass
¶
FabMenuItem(icon: IconLike, label: LabelLike, on_click: Optional[VoidCallback] = None, disabled: Union[bool, ObservableProtocol[bool]] = False)
Declarative spec for a single action inside a :class:FabMenu.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
icon
|
IconLike
|
Leading icon shown in the menu-item pill. |
required |
label
|
LabelLike
|
Text label rendered next to the icon. |
required |
on_click
|
Optional[VoidCallback]
|
Optional callback invoked when the item is selected. |
None
|
disabled
|
Union[bool, ObservableProtocol[bool]]
|
Whether the item is disabled (non-interactive). |
False
|
LoadingIntent
dataclass
¶
Intent for showing a loading indicator via MaterialOverlay.
This is a marker intent with no parameters. Visual properties should be configured via overlay_routes in MaterialApp.
Icon
¶
Icon(name: Symbol | str | ReadOnlyObservableProtocol[Symbol] | ReadOnlyObservableProtocol[str], *, size: SizingLike = 24, padding: Optional[Tuple[int, int, int, int] | Tuple[int, int] | int] = None, style: Optional['IconStyle'] = None)
Bases: IconBase
Material Symbols icon widget (M3準拠).
Parameters: - name: Ligature name (e.g. "home", "menu") or Symbol - size: Icon visual size in pixels (default 24dp) - padding: Space around icon (M3: "space between UI elements") - style: IconStyle for customization (defaults to theme style)
Create a Material-like icon by ligature name.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
name
|
Symbol | str | ReadOnlyObservableProtocol[Symbol] | ReadOnlyObservableProtocol[str]
|
Ligature name such as "home", "menu", "search", a Symbol, or an Observable that yields either. |
required |
size
|
SizingLike
|
Logical pixel size of the icon (font size used for the glyph). |
24
|
padding
|
Optional[Tuple[int, int, int, int] | Tuple[int, int] | int]
|
Space around the icon (M3: "space between UI elements"). |
None
|
style
|
Optional['IconStyle']
|
IconStyle for customization (defaults to theme style). |
None
|
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
438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 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 | |
NavigationRail
¶
NavigationRail(children: Sequence[RailItem], *, index: Union[int, _ObservableValue[int]] = 0, on_select: Optional[Callable[[int], None]] = None, expanded: Union[bool, _ObservableValue[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)
Bases: 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, _ObservableValue[int]]
|
The currently selected index (int or Observable). |
0
|
on_select
|
Optional[Callable[[int], None]]
|
Callback when an item is selected. |
None
|
expanded
|
Union[bool, _ObservableValue[bool]]
|
Whether the rail is expanded (bool or Observable). |
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
|
Source code in src/nuiitivet/material/navigation_rail.py
712 713 714 715 716 717 718 719 720 721 722 723 724 725 726 727 728 729 730 731 732 733 734 735 736 737 738 739 740 741 742 743 744 745 746 747 748 749 750 751 752 753 754 755 756 757 758 759 760 761 762 763 764 765 766 767 768 769 770 771 772 773 774 775 776 777 778 779 780 781 782 783 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 | |
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: str, label: str, *, small_badge: Optional[ReadOnlyObservableProtocol[bool]] = None, large_badge: Optional[ReadOnlyObservableProtocol[Optional[str]]] = None, style: Optional[NavigationRailStyle] = 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
|
str
|
The icon name to display. |
required |
label
|
str
|
The label text to display. |
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
|
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)
Bases: Toggleable, InteractiveWidget
A minimal Material-like Checkbox widget (M3).
Parameters: - checked: Checked state source (bool / Observable[bool] / Observable[Optional[bool]]) - on_toggle: Callback when toggled - padding: Space around the checkbox (M3: "space between UI elements") - indeterminate: Indeterminate flag (bool / Observable[bool]) - disabled: Disable interaction (bool / Observable[bool]) - style: CheckboxStyle for visual customization (defaults to theme style)
Source code in src/nuiitivet/material/selection_controls.py
preferred_size
¶
preferred_size(max_width: Optional[int] = None, max_height: Optional[int] = None) -> Tuple[int, int]
Return preferred size including padding (M3準拠).
Source code in src/nuiitivet/material/selection_controls.py
paint
¶
Paint checkbox with padding support (M3準拠).
Source code in src/nuiitivet/material/selection_controls.py
307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 | |
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)
Bases: Toggleable, InteractiveWidget
Material Design 3 RadioButton controlled by nearest RadioGroup.
Initialize RadioButton.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
value
|
object | None
|
Option value represented by this radio button. |
required |
disabled
|
bool | ObservableProtocol[bool]
|
Disable interaction when True. |
False
|
padding
|
Optional[Union[int, Tuple[int, int], Tuple[int, int, int, int]]]
|
Space around the touch target. |
None
|
style
|
Optional['RadioButtonStyle']
|
Style override. Uses theme style when omitted. |
None
|
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
674 675 676 677 678 679 680 681 682 683 684 685 686 687 688 689 690 691 692 693 694 695 696 697 698 699 700 701 702 703 704 705 706 707 708 709 710 711 712 713 714 715 716 717 718 719 720 721 722 723 724 725 726 727 728 729 730 731 732 733 734 735 736 737 738 739 740 741 742 743 744 745 746 747 748 749 750 751 752 753 754 755 756 757 758 759 760 761 762 763 764 765 766 767 768 769 770 771 772 773 774 775 776 777 778 779 780 781 | |
RadioGroup
¶
RadioGroup(child: Widget, *, value: object | ObservableProtocol[object | None] | None = None, on_change: Optional[Callable[[object | None], None]] = None)
Bases: Container
Container that manages a single selected value for descendant RadioButtons.
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
|
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)
Bases: Toggleable, InteractiveWidget
Material Design 3 Switch widget.
Initialize Switch.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
checked
|
bool | ObservableProtocol[bool]
|
Checked state source (bool or observable bool). |
False
|
on_change
|
Optional[Callable[[bool], None]]
|
Callback invoked when checked state changes. |
None
|
disabled
|
bool | ObservableProtocol[bool]
|
Disable interaction when True. |
False
|
padding
|
Optional[Union[int, Tuple[int, int], Tuple[int, int, int, int]]]
|
Space around the switch. |
None
|
style
|
Optional['SwitchStyle']
|
Style override. Uses theme style when omitted. |
None
|
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 switch with animated thumb and track.
Source code in src/nuiitivet/material/selection_controls.py
904 905 906 907 908 909 910 911 912 913 914 915 916 917 918 919 920 921 922 923 924 925 926 927 928 929 930 931 932 933 934 935 936 937 938 939 940 941 942 943 944 945 946 947 948 949 950 951 952 953 954 955 956 957 958 959 960 961 962 963 964 965 966 967 968 969 970 971 972 973 974 975 976 977 978 979 980 981 982 983 984 985 986 987 988 989 990 991 992 993 994 995 996 997 998 999 1000 1001 1002 1003 1004 1005 1006 1007 1008 1009 1010 1011 1012 1013 1014 1015 1016 1017 1018 1019 1020 1021 1022 1023 1024 1025 1026 1027 1028 1029 1030 1031 1032 1033 1034 1035 1036 1037 1038 1039 1040 1041 | |
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 = '1%', padding: Optional[Tuple[int, int] | Tuple[int, int, int, int] | int] = None, style: Optional['SliderStyle'] = 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. |
'1%'
|
padding
|
Optional[Tuple[int, int] | Tuple[int, int, int, int] | int]
|
Slider padding. |
None
|
style
|
Optional['SliderStyle']
|
Optional SliderStyle override. |
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 = '1%', padding: Optional[Tuple[int, int] | Tuple[int, int, int, int] | int] = None, style: Optional['SliderStyle'] = 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. |
'1%'
|
padding
|
Optional[Tuple[int, int] | Tuple[int, int, int, int] | int]
|
Slider padding. |
None
|
style
|
Optional['SliderStyle']
|
Optional SliderStyle override. |
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 = '1%', padding: Optional[Tuple[int, int] | Tuple[int, int, int, int] | int] = None, style: Optional['SliderStyle'] = 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. |
'1%'
|
padding
|
Optional[Tuple[int, int] | Tuple[int, int, int, int] | int]
|
Slider padding. |
None
|
style
|
Optional['SliderStyle']
|
Optional SliderStyle override. |
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 = '1%', padding: Optional[Tuple[int, int] | Tuple[int, int, int, int] | int] = None, style: Optional['SliderStyle'] = 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. |
'1%'
|
padding
|
Optional[Tuple[int, int] | Tuple[int, int, int, int] | int]
|
Slider padding. |
None
|
style
|
Optional['SliderStyle']
|
Optional SliderStyle override. |
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 = '1%', padding: Optional[Tuple[int, int] | Tuple[int, int, int, int] | int] = None, style: Optional['SliderStyle'] = 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. |
'1%'
|
padding
|
Optional[Tuple[int, int] | Tuple[int, int, int, int] | int]
|
Slider padding. |
None
|
style
|
Optional['SliderStyle']
|
Optional SliderStyle override. |
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 = '1%', padding: Optional[Tuple[int, int] | Tuple[int, int, int, int] | int] = None, style: Optional['SliderStyle'] = 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. |
'1%'
|
padding
|
Optional[Tuple[int, int] | Tuple[int, int, int, int] | int]
|
Slider padding. |
None
|
style
|
Optional['SliderStyle']
|
Optional SliderStyle override. |
None
|
Source code in src/nuiitivet/material/slider.py
Symbols
¶
Material Symbols constants (auto-generated).
TextField
¶
TextField(value: Union[str, ObservableProtocol[str]] = '', on_change: Optional[Callable[[str], None]] = 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 | ObservableProtocol[bool] | None = None, error_text: str | ReadOnlyObservableProtocol[str | None] | None = None, disabled: bool | ObservableProtocol[bool] = False, width: SizingLike = 200, padding: Union[int, Tuple[int, int], Tuple[int, int, int, int]] = 0, style: Optional[TextFieldStyle] = None)
Bases: InteractiveWidget
A text input widget base class.
Note
The constructor TextField(value=observable) establishes a one-way binding.
Changes in the observable will update the text field, but user input will NOT
update the observable automatically.
For two-way binding, use the TextField.two_way(observable) factory method.
Parameters: - value: Initial text value (str or TextEditingValue) OR External observable - on_change: Callback when value changes - label: Floating label text (supports Observable) - leading_icon: Icon source (Symbol/str or Observable of them) - on_tap_leading_icon: Callback invoked when the leading icon is tapped - trailing_icon: Icon source (Symbol/str or Observable of them) - on_tap_trailing_icon: Callback invoked when the trailing icon is tapped - obscure_text: Whether to mask text display (password-style) - supporting_text: Supporting text to display below the field (supports Observable) - is_error: Whether the field is in error state (supports Observable) - style: Custom style configuration - width: Explicit width sizing - height: Explicit height sizing - padding: Space around the text field - disabled: Disable interaction (supports Observable)
Initialize TextField.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
value
|
Union[str, ObservableProtocol[str]]
|
Initial text value or observable. |
''
|
on_change
|
Optional[Callable[[str], None]]
|
Callback when value changes. |
None
|
label
|
str | ReadOnlyObservableProtocol[str] | None
|
Floating label text. |
None
|
leading_icon
|
Symbol | str | ReadOnlyObservableProtocol[Symbol] | ReadOnlyObservableProtocol[str] | None
|
Icon displayed before the text. |
None
|
on_tap_leading_icon
|
Optional[Callable[[], None]]
|
Callback invoked when the leading icon is tapped. |
None
|
trailing_icon
|
Symbol | str | ReadOnlyObservableProtocol[Symbol] | ReadOnlyObservableProtocol[str] | None
|
Icon displayed after the text. |
None
|
on_tap_trailing_icon
|
Optional[Callable[[], None]]
|
Callback invoked when the trailing icon is tapped. |
None
|
obscure_text
|
bool
|
Whether to mask text display (password-style). |
False
|
supporting_text
|
str | ReadOnlyObservableProtocol[str | None] | None
|
Supporting text displayed below the field. |
None
|
is_error
|
bool | ObservableProtocol[bool] | None
|
Whether to use error colors for the field. |
None
|
error_text
|
str | ReadOnlyObservableProtocol[str | None] | None
|
Deprecated alias for supporting_text. |
None
|
disabled
|
bool | ObservableProtocol[bool]
|
Whether the text field is disabled. |
False
|
width
|
SizingLike
|
Width specification. |
200
|
padding
|
Union[int, Tuple[int, int], Tuple[int, int, int, int]]
|
Padding around the text field. |
0
|
style
|
Optional[TextFieldStyle]
|
Custom style configuration. |
None
|
Source code in src/nuiitivet/material/text_fields.py
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 | |
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.
two_way
classmethod
¶
two_way(value: ObservableProtocol[str], *, on_change: Optional[Callable[[str], None]] = None, **kwargs) -> TTextField
Create a two-way bound TextField.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
value
|
ObservableProtocol[str]
|
The observable value to bind to. |
required |
on_change
|
Optional[Callable[[str], None]]
|
Optional callback when value changes (in addition to updating the observable). |
None
|
**kwargs
|
Additional arguments passed to the constructor. |
{}
|
Returns:
| Type | Description |
|---|---|
TTextField
|
Review instance of the TextField class. |
Source code in src/nuiitivet/material/text_fields.py
preferred_size
¶
preferred_size(max_width: Optional[int] = None, max_height: Optional[int] = None) -> Tuple[int, int]
Return the preferred (width, height) for this TextField.
Source code in src/nuiitivet/material/text_fields.py
focus
¶
Programmatically focus the TextField (keyboard-style focus).
Delegates to the inner EditableText. This path does NOT mark the
focus as pointer-driven, so the focus ring will be shown — use
this for keyboard / API-initiated focus only. Pointer presses go
through _handle_press which calls
EditableText.request_focus_from_pointer to suppress the ring
per MD3 spec.
Source code in src/nuiitivet/material/text_fields.py
TextFieldStyle
dataclass
¶
TextFieldStyle(mode: TextFieldMode = 'filled', container_color: ColorSpec = SURFACE_CONTAINER_HIGHEST, indicator_color: ColorSpec = ON_SURFACE_VARIANT, indicator_width: float = 1.0, focused_indicator_color: ColorSpec = PRIMARY, focused_indicator_width: float = 2.0, error_indicator_color: ColorSpec = ERROR, text_color: ColorSpec = ON_SURFACE, label_color: ColorSpec = ON_SURFACE_VARIANT, focused_label_color: ColorSpec = PRIMARY, error_label_color: ColorSpec = ERROR, supporting_text_color: ColorSpec = ON_SURFACE_VARIANT, error_supporting_text_color: ColorSpec = ERROR, cursor_color: ColorSpec = PRIMARY, error_cursor_color: ColorSpec = ERROR, selection_color: ColorSpec = PRIMARY_CONTAINER, border_radius: float = 4.0, content_padding: Tuple[int, int, int, int] = (16, 16, 16, 16))
Style configuration for :class:TextField (M3-compliant).
The visual variant is captured by the :attr:mode field: "filled"
draws an underline indicator with top-rounded container corners while
"outlined" draws a full rectangular border. Use the :meth:filled
and :meth:outlined factory methods to obtain the standard presets.
copy_with
¶
filled
classmethod
¶
Default M3 Filled TextField style.
Source code in src/nuiitivet/material/styles/text_field_style.py
outlined
classmethod
¶
Default M3 Outlined TextField style.
Source code in src/nuiitivet/material/styles/text_field_style.py
from_theme
classmethod
¶
Resolve the default :class:TextFieldStyle for the given theme.
Returns the theme's filled text field style if a Material theme
extension is present, otherwise a fresh :meth:filled preset.
Source code in src/nuiitivet/material/styles/text_field_style.py
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)
Bases: TextBase
Material text widget.
Defaults to the current Material theme TextStyle.
Initialize Material Text widget.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
label
|
Union[str, ReadOnlyObservableProtocol[Any]]
|
The text content to display. Can be a string or an Observable. |
required |
width
|
SizingLike
|
Width specification. |
None
|
height
|
SizingLike
|
Height specification. |
None
|
padding
|
Union[int, Tuple[int, int], Tuple[int, int, int, int]]
|
Padding around the text. |
0
|
style
|
Optional['TextStyle']
|
Custom Material TextStyle (color, font_family). |
None
|
type_scale
|
Optional[TypeScaleToken]
|
MD3 type-scale token supplying typography. Defaults to Body Medium. |
None
|
alignment
|
Literal['start', 'center', 'end']
|
Horizontal text alignment ( |
'start'
|
max_lines
|
Optional[int]
|
Maximum number of lines ( |
None
|
overflow
|
Literal['visible', 'clip', 'ellipsis']
|
Overflow handling: |
'visible'
|
truncation
|
Literal['tail', 'head', 'middle']
|
Ellipsis position: |
'tail'
|
soft_wrap
|
bool
|
Whether to wrap at soft line breaks when width is bounded. |
True
|
Source code in src/nuiitivet/material/text.py
style
property
¶
Return the current text style, resolving from theme if necessary.
Navigator
¶
Navigator(screen: Route | Widget | None = None, *, layer_composer: NavigationLayerComposer | None = None)
Bases: Navigator
Navigator that applies Material default transition specs.
Source code in src/nuiitivet/navigation/navigator.py
Overlay
¶
Overlay(*, intent_resolver: IntentResolver | None = None, intents: Mapping[type[Any], Callable[[Any], Widget | Route]] | None = None)
Bases: Overlay
Overlay subclass that provides Material-specific helpers.
Source code in src/nuiitivet/material/overlay.py
loading
¶
loading(indicator: Widget | Route | Any | None = None) -> OverlayHandle[Any]
Show a loading indicator overlay and return a handle for manual dismissal.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
indicator
|
Widget | Route | Any | None
|
Widget, Route, 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 | Route | 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 | Route | Any | None
|
Widget, Route, 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, *, dismiss_on_outside_tap: bool = True) -> OverlayHandle[Any]
Display a modal side sheet.
The sheet's position, corner radii, and transition direction are derived
from sheet.side. Visual styling (background, size, corner radius) is
fully owned by the :class:SideSheet widget.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
sheet
|
Widget
|
SideSheet widget (or a wrapper such as one produced by
|
required |
dismiss_on_outside_tap
|
bool
|
Whether tapping the scrim dismisses the sheet.
Defaults to |
True
|
Source code in src/nuiitivet/material/overlay.py
bottom_sheet
¶
bottom_sheet(sheet: Widget, *, dismiss_on_outside_tap: bool = True) -> OverlayHandle[Any]
Display a modal bottom sheet sliding up from the bottom edge.
Visual styling (background, size, corner radius) is fully owned by the
:class:BottomSheet widget.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
sheet
|
Widget
|
BottomSheet widget (or a wrapper such as one produced by
|
required |
dismiss_on_outside_tap
|
bool
|
Whether tapping the scrim dismisses the sheet.
Defaults to |
True
|
Source code in src/nuiitivet/material/overlay.py
WhileLoading
¶
WhileLoading(overlay: 'MaterialOverlay', indicator: Widget | Route | 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
ThemeFactory
¶
Factory for creating Themes with Material Design configuration.
from_seed
staticmethod
¶
Create Material theme from seed color.
Source code in src/nuiitivet/material/theme/material_theme.py
from_seed_pair
staticmethod
¶
Create light and dark themes from a seed color.
Source code in src/nuiitivet/material/theme/material_theme.py
DockedToolbar
¶
Bases: Box
Material Design 3 docked toolbar.
This toolbar is edge-to-edge and therefore does not expose external padding.
Initialize DockedToolbar.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
buttons
|
Sequence[MaterialButtonBase]
|
Action buttons placed inside the toolbar. |
required |
style
|
Optional[ToolbarStyle]
|
Optional toolbar style. Defaults to |
None
|
Source code in src/nuiitivet/material/toolbar.py
HorizontalFloatingToolbar
¶
HorizontalFloatingToolbar(buttons: Sequence[MaterialButtonBase], *, padding: PaddingLike = 0, style: Optional[ToolbarStyle] = None)
Bases: _FloatingToolbarBase
Material Design 3 horizontal floating toolbar.
Lays out action buttons in a row inside a fully rounded floating container.
Initialize HorizontalFloatingToolbar.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
buttons
|
Sequence[MaterialButtonBase]
|
Action buttons placed inside the toolbar. |
required |
padding
|
PaddingLike
|
External padding around the floating toolbar. |
0
|
style
|
Optional[ToolbarStyle]
|
Optional toolbar style. Defaults to |
None
|
Source code in src/nuiitivet/material/toolbar.py
VerticalFloatingToolbar
¶
VerticalFloatingToolbar(buttons: Sequence[MaterialButtonBase], *, padding: PaddingLike = 0, style: Optional[ToolbarStyle] = None)
Bases: _FloatingToolbarBase
Material Design 3 vertical floating toolbar.
Lays out action buttons in a column inside a fully rounded floating container.
Initialize VerticalFloatingToolbar.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
buttons
|
Sequence[MaterialButtonBase]
|
Action buttons placed inside the toolbar. |
required |
padding
|
PaddingLike
|
External padding around the floating toolbar. |
0
|
style
|
Optional[ToolbarStyle]
|
Optional toolbar style. Defaults to |
None
|
Source code in src/nuiitivet/material/toolbar.py
Tooltip
¶
Tooltip(message: str, *, width: SizingLike = None, height: SizingLike = None, style: TooltipStyle | 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
|
Source code in src/nuiitivet/material/tooltip.py
style
property
¶
Return tooltip style resolved from user style or current theme.
RichTooltip
¶
RichTooltip(supporting_text: str, *, subhead: str | None = None, action_label: str | None = None, on_action_click: Callable[[], None] | None = None, action_label_2: str | None = None, on_action_click_2: Callable[[], None] | None = None, width: SizingLike = None, height: SizingLike = None, style: RichTooltipStyle | None = None)
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
|
Source code in src/nuiitivet/material/tooltip.py
style
property
¶
Return rich tooltip style resolved from user style or current theme.
preferred_size
¶
preferred_size(max_width: Optional[int] = None, max_height: Optional[int] = None) -> Tuple[int, int]
Return preferred size clamped to [min_width, max_width] when auto-sized.
Source code in src/nuiitivet/material/tooltip.py
SideSheetStyle
dataclass
¶
SideSheetStyle(width: SizingLike = 400, height: SizingLike = '100%', 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 "100%" so the sheet spans the full screen height.
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 = '100%', 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 "100%" so the sheet spans the full screen width.
height=None means the container sizes to its content.
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 = '100%', 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 "100%" so the sheet spans the full content area height.
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, ReadOnlyObservableProtocol[str]], side: Literal['right', 'left'] = 'right', on_back: Optional[Callable[[], None]] = None, show_back_button: Union[bool, ReadOnlyObservableProtocol[bool]] = False, style: Optional[SideSheetStyle] = 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))
)
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
content
|
Widget
|
Widget to display below the header. |
required |
headline
|
Union[str, ReadOnlyObservableProtocol[str]]
|
Header title text (str or Observable[str]). Required by M3. |
required |
side
|
Literal['right', 'left']
|
Edge the sheet slides in from ( |
'right'
|
on_back
|
Optional[Callable[[], None]]
|
Callback invoked when the Back icon button is pressed. Back button visibility is controlled separately by show_back_button. |
None
|
show_back_button
|
Union[bool, ReadOnlyObservableProtocol[bool]]
|
Whether to show the Back icon button.
Accepts |
False
|
style
|
Optional[SideSheetStyle]
|
Container style. Defaults to :class: |
None
|
Initialize SideSheet.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
content
|
Widget
|
Widget to display below the header. |
required |
headline
|
Union[str, ReadOnlyObservableProtocol[str]]
|
Header title text (str or Observable[str]). |
required |
side
|
Literal['right', 'left']
|
Edge the sheet slides in from. Defaults to |
'right'
|
on_back
|
Optional[Callable[[], None]]
|
Callback for the Back icon button press. |
None
|
show_back_button
|
Union[bool, ReadOnlyObservableProtocol[bool]]
|
Back button visibility (bool or Observable[bool]).
Defaults to |
False
|
style
|
Optional[SideSheetStyle]
|
Container style. Defaults to :class: |
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, ReadOnlyObservableProtocol[str]], style: Optional[BottomSheetStyle] = None)
Bases: ComposableWidget, OverlayAware[None]
Modal bottom sheet container widget.
Renders an M3-compliant header (Headline, Close button) above content.
Pass this widget to MaterialOverlay.bottom_sheet().
The header layout is fixed by M3 spec::
[ Headline ] [ Close ]
The Close button always dismisses the sheet through the overlay's unified
dismissal pipeline. To intercept the close (for unsaved changes, etc.),
attach a will_pop modifier.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
content
|
Widget
|
Widget to display below the header. |
required |
headline
|
Union[str, ReadOnlyObservableProtocol[str]]
|
Header title text (str or Observable[str]). Required by M3. |
required |
style
|
Optional[BottomSheetStyle]
|
Container size, background, and shape options.
Defaults to :class: |
None
|
Initialize BottomSheet.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
content
|
Widget
|
Widget to display below the header. |
required |
headline
|
Union[str, ReadOnlyObservableProtocol[str]]
|
Header title text (str or Observable[str]). |
required |
style
|
Optional[BottomSheetStyle]
|
Container style. Defaults to :class: |
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, *, headline: Optional[Union[str, ReadOnlyObservableProtocol[str]]] = None, side: Literal['right', 'left'] = 'right', on_close: Optional[Callable[[], None]] = None, style: Optional[StandardSideSheetStyle] = 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 does not manage its own open/close animation;
wrap it in :class:~nuiitivet.layout.collapsible.Collapsible when
animated expand/collapse is needed::
Row([
main_content,
Collapsible(
StandardSideSheet(
panel_content,
headline="Filters",
on_close=vm.close_panel,
),
opened=vm.panel_open,
axis="horizontal",
alignment="top_right",
),
])
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
content
|
Widget
|
Widget to display inside the sheet. |
required |
headline
|
Optional[Union[str, ReadOnlyObservableProtocol[str]]]
|
Optional header title text ( |
None
|
side
|
Literal['right', 'left']
|
Edge the sheet is attached to ( |
'right'
|
on_close
|
Optional[Callable[[], None]]
|
Callback invoked when the close icon button is pressed.
When |
None
|
style
|
Optional[StandardSideSheetStyle]
|
Container style. Defaults to :class: |
None
|
Initialize StandardSideSheet.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
content
|
Widget
|
Widget to display inside the sheet. |
required |
headline
|
Optional[Union[str, ReadOnlyObservableProtocol[str]]]
|
Optional header title (str or Observable[str]). |
None
|
side
|
Literal['right', 'left']
|
Attachment edge ( |
'right'
|
on_close
|
Optional[Callable[[], None]]
|
Callback for the close icon button. No button is shown
when |
None
|
style
|
Optional[StandardSideSheetStyle]
|
Container style. Defaults to :class: |
None
|
Source code in src/nuiitivet/material/sheet.py
on_mount
¶
Mount and subscribe to headline observable if provided.
Source code in src/nuiitivet/material/sheet.py
build
¶
build() -> Widget
Build the sheet: outer Box with optional header Row and content.
Source code in src/nuiitivet/material/sheet.py
GroupButton
¶
GroupButton(label: 'str | ReadOnlyObservableProtocol[str] | None' = None, icon: 'Symbol | str | ReadOnlyObservableProtocol | None' = None, *, selected: 'bool | ObservableProtocol[bool]' = False, on_change: Optional[BoolCallback] = None, disabled: 'bool | ObservableProtocol[bool]' = False, width: SizingLike = None, style: 'Optional[ButtonGroupStyle]' = None)
Bases: InteractiveWidget
A single interactive segment in a ButtonGroup (Standard or Connected).
Handles position-aware corner-radius shape morphing via EXPRESSIVE_FAST_SPATIAL
motion on press / release. set_position() is called exclusively by the
containing _ButtonGroupBase during on_mount; it is not part of the
public user API.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
label
|
'str | ReadOnlyObservableProtocol[str] | None'
|
Optional text label. Can be a plain |
None
|
icon
|
'Symbol | str | ReadOnlyObservableProtocol | None'
|
Optional icon. Accepts a |
None
|
selected
|
'bool | ObservableProtocol[bool]'
|
Initial selected (toggle) state. Pass an
|
False
|
on_change
|
Optional[BoolCallback]
|
Callback fired with the new |
None
|
disabled
|
'bool | ObservableProtocol[bool]'
|
Whether the item ignores pointer events. |
False
|
width
|
SizingLike
|
Optional width sizing. |
None
|
style
|
'Optional[ButtonGroupStyle]'
|
Optional style override. If omitted the |
None
|
Initialize GroupButton.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
label
|
'str | ReadOnlyObservableProtocol[str] | None'
|
Text label, or an observable string. |
None
|
icon
|
'Symbol | str | ReadOnlyObservableProtocol | None'
|
Icon symbol, string name, or observable icon. |
None
|
selected
|
'bool | ObservableProtocol[bool]'
|
Initial selected state, or an observable bool. |
False
|
on_change
|
Optional[BoolCallback]
|
Toggle-state change callback. |
None
|
disabled
|
'bool | ObservableProtocol[bool]'
|
Disable interaction. |
False
|
width
|
SizingLike
|
Width sizing spec. |
None
|
style
|
'Optional[ButtonGroupStyle]'
|
Visual style override. |
None
|
Source code in src/nuiitivet/material/button_group.py
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 | |
preferred_size
¶
preferred_size(max_width: Optional[int] = None, max_height: Optional[int] = None) -> Tuple[int, int]
Return preferred size.
Connected groups enforce a visual minimum width (M3: 48dp for XS/S segments). Standard groups are content-fit: their 48dp spec value is an accessible tap-target requirement, not a visual width floor, so it is intentionally not applied to the rendered width here.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
max_width
|
Optional[int]
|
Available width constraint. |
None
|
max_height
|
Optional[int]
|
Available height constraint. |
None
|
Returns:
| Type | Description |
|---|---|
Tuple[int, int]
|
|
Source code in src/nuiitivet/material/button_group.py
set_position
¶
set_position(position: ButtonGroupPosition, adjacent_animation: bool = True) -> None
Configure this item's position within its group.
Called exclusively by _ButtonGroupBase.on_mount(). Snaps the
corner radius to the idle value for the given position without
animation, then arms the EXPRESSIVE_FAST_SPATIAL motion for
subsequent press interactions.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
position
|
ButtonGroupPosition
|
One of |
required |
adjacent_animation
|
bool
|
|
True
|
Source code in src/nuiitivet/material/button_group.py
on_mount
¶
Subscribe to corner animation and external selected observable.
Source code in src/nuiitivet/material/button_group.py
StandardButtonGroup
¶
StandardButtonGroup(items: Sequence[GroupButton], *, style: 'Optional[StandardButtonGroupStyle]' = None)
Bases: _ButtonGroupBase
A ButtonGroup that organises action or toggle segments horizontally.
Width fits the combined item widths. When a segment is activated (pressed)
or selected, the MD3 adjacent interaction runs: the active segment animates
its width, shape, and (via centered content) padding, while its
direct neighbors shrink to compensate so the group's overall width stays
stable. All transitions use M3 Expressive (EXPRESSIVE_FAST_SPATIAL)
motion. Item selected states are independent — no group-level enforcement.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
items
|
Sequence[GroupButton]
|
Between 2 and 5 |
required |
style
|
'Optional[StandardButtonGroupStyle]'
|
Visual style. Use |
None
|
Initialize StandardButtonGroup.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
items
|
Sequence[GroupButton]
|
Between 2 and 5 |
required |
style
|
'Optional[StandardButtonGroupStyle]'
|
Visual style override. Defaults to
|
None
|
Source code in src/nuiitivet/material/button_group.py
ConnectedButtonGroup
¶
ConnectedButtonGroup(items: Sequence[GroupButton], *, select_mode: Literal['single', 'multi'] = 'single', style: 'Optional[ConnectedButtonGroupStyle]' = None)
Bases: _ButtonGroupBase
A ButtonGroup that functions as an option selector / view switcher.
Width expands to fill the containing widget (width="100%"). Items
share space equally (Sizing.flex(1)). Only corner shapes animate on
press — adjacent segment corners are unaffected. Selection is always
enforced by the group.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
items
|
Sequence[GroupButton]
|
Between 2 and 5 |
required |
select_mode
|
Literal['single', 'multi']
|
|
'single'
|
style
|
'Optional[ConnectedButtonGroupStyle]'
|
Visual style. Use |
None
|
Initialize ConnectedButtonGroup.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
items
|
Sequence[GroupButton]
|
Between 2 and 5 |
required |
select_mode
|
Literal['single', 'multi']
|
|
'single'
|
style
|
'Optional[ConnectedButtonGroupStyle]'
|
Visual style override. Defaults to
|
None
|
Source code in src/nuiitivet/material/button_group.py
on_mount
¶
Assign positions, set flex 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
from_theme
classmethod
¶
from_theme(theme: 'Theme | None', variant: str, size: ButtonSize = 's') -> 'StandardButtonGroupStyle'
Create a style from a theme and variant name.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
theme
|
'Theme | None'
|
The active theme (currently unused; colours are role-based). |
required |
variant
|
str
|
One of |
required |
size
|
ButtonSize
|
M3 size token preset. |
's'
|
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
from_theme
classmethod
¶
from_theme(theme: 'Theme | None', variant: str, size: ButtonSize = 's') -> 'ConnectedButtonGroupStyle'
Create a style from a theme and variant name.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
theme
|
'Theme | None'
|
The active theme (currently unused; colours are role-based). |
required |
variant
|
str
|
One of |
required |
size
|
ButtonSize
|
M3 size token preset. |
's'
|
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 | ObservableProtocol[bool]' = False, disabled: 'bool | ObservableProtocol[bool]' = False, width: SizingLike = None, style: 'Optional[SplitButtonStyle]' = None)
Bases: Box
Material Design 3 Expressive Split Button.
Combines a leading button (main action) with a trailing button (menu trigger). The two halves share an animated inner corner junction that morphs on hover and press. The trailing button's icon rotates 180° when the menu is opened.
Spec: https://m3.material.io/components/split-button/specs
Example::
SplitButton(
"Start",
icon="play_arrow",
on_click=lambda: start_action(),
on_menu_toggle=lambda open: handle_menu(open),
style=SplitButtonStyle.filled("s"),
)
Initialize SplitButton.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
label
|
'str | Any | None'
|
Text label for the leading button. Either |
None
|
icon
|
'Symbol | str | Any | None'
|
Leading icon for the leading button. Accepts a
:class: |
None
|
on_click
|
Optional[VoidCallback]
|
Callback invoked when the leading button is clicked. |
None
|
on_menu_toggle
|
Optional[BoolCallback]
|
Callback invoked with the new |
None
|
menu_open
|
'bool | ObservableProtocol[bool]'
|
Initial menu open (selected) state of the trailing
button. Pass an :class: |
False
|
disabled
|
'bool | ObservableProtocol[bool]'
|
Disables both button halves when |
False
|
width
|
SizingLike
|
Optional width sizing for the overall widget. |
None
|
style
|
'Optional[SplitButtonStyle]'
|
Visual style. Defaults to |
None
|
Source code in src/nuiitivet/material/split_button.py
menu_open
property
¶
Whether the menu is currently open (trailing button selected).
Returns:
| Type | Description |
|---|---|
bool
|
|
SplitButtonStyle
dataclass
¶
SplitButtonStyle(background: Optional[ColorSpec] = None, foreground: Optional[ColorSpec] = None, border_color: Optional[ColorSpec] = None, border_width: float = 0.0, elevation: int = 0, overlay_color: Optional[ColorSpec] = None, overlay_alpha: float = 0.12, container_height: int = 40, between_space: int = 2, outer_corner_radius: float = 20.0, inner_corner_radius: float = 4.0, inner_corner_hovered_radius: float = 12.0, inner_corner_pressed_radius: float = 12.0, leading_leading_space: int = 16, leading_trailing_space: int = 12, trailing_icon_size: int = 22, trailing_leading_space: int = 13, trailing_trailing_space: int = 13, menu_icon_offset: int = -1, label_font_size: int = 14, icon_size: int = 20)
Immutable style for :class:SplitButton (M3 Expressive-compliant).
Use the filled, elevated, tonal, or outlined factory
classmethods rather than constructing directly where possible.
All size-related tokens are driven by :data:SPLIT_BUTTON_SIZE_TOKENS.
copy_with
¶
Return a new style with the specified fields replaced.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
**changes
|
Fields to override. |
{}
|
Returns:
| Type | Description |
|---|---|
'SplitButtonStyle'
|
A new :class: |
Source code in src/nuiitivet/material/styles/split_button_style.py
filled
classmethod
¶
filled(size: ButtonSize = 's') -> 'SplitButtonStyle'
Create a filled-variant style.
Uses Primary as the container colour.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
size
|
ButtonSize
|
M3 size token preset ( |
's'
|
Returns:
| Type | Description |
|---|---|
'SplitButtonStyle'
|
A new :class: |
Source code in src/nuiitivet/material/styles/split_button_style.py
elevated
classmethod
¶
elevated(size: ButtonSize = 's') -> 'SplitButtonStyle'
Create an elevated-variant style.
Uses Surface as the container colour with elevation level 1.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
size
|
ButtonSize
|
M3 size token preset ( |
's'
|
Returns:
| Type | Description |
|---|---|
'SplitButtonStyle'
|
A new :class: |
Source code in src/nuiitivet/material/styles/split_button_style.py
tonal
classmethod
¶
tonal(size: ButtonSize = 's') -> 'SplitButtonStyle'
Create a tonal-variant style.
Uses SecondaryContainer as the container colour.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
size
|
ButtonSize
|
M3 size token preset ( |
's'
|
Returns:
| Type | Description |
|---|---|
'SplitButtonStyle'
|
A new :class: |
Source code in src/nuiitivet/material/styles/split_button_style.py
outlined
classmethod
¶
outlined(size: ButtonSize = 's') -> 'SplitButtonStyle'
Create an outlined-variant style.
Uses a transparent background with an Outline-coloured border.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
size
|
ButtonSize
|
M3 size token preset ( |
's'
|
Returns:
| Type | Description |
|---|---|
'SplitButtonStyle'
|
A new :class: |
Source code in src/nuiitivet/material/styles/split_button_style.py
MaterialTransitionSpec
dataclass
¶
MaterialTransitionSpec(enter: TransitionDefinition, exit_: TransitionDefinition, barrier_mode: Literal['none', 'fade'] = 'none')
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)
DockedDatePicker
¶
DockedDatePicker(value: ObservableProtocol[Optional[date]], *, on_change: Optional[Callable[[Optional[date]], None]] = None, min_date: Optional[date] = None, max_date: Optional[date] = None, style: Optional['DockedDatePickerStyle'] = None)
Bases: ComposableWidget
Material Design 3 Docked 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).
MD3 container: 360×456dp, Large corner rounding (16dp).
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
value
|
ObservableProtocol[Optional[date]]
|
Observable holding the currently selected :class: |
required |
on_change
|
Optional[Callable[[Optional[date]], None]]
|
Optional callback invoked after the value is updated. |
None
|
min_date
|
Optional[date]
|
Earliest selectable date. |
None
|
max_date
|
Optional[date]
|
Latest selectable date. |
None
|
style
|
Optional['DockedDatePickerStyle']
|
Visual style. Defaults to :class: |
None
|
Initialize DockedDatePicker.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
value
|
ObservableProtocol[Optional[date]]
|
Observable holding the selected date (or None). |
required |
on_change
|
Optional[Callable[[Optional[date]], None]]
|
Callback invoked when the user selects a date. |
None
|
min_date
|
Optional[date]
|
Minimum selectable date. |
None
|
max_date
|
Optional[date]
|
Maximum selectable date. |
None
|
style
|
Optional['DockedDatePickerStyle']
|
Optional style override. |
None
|
Source code in src/nuiitivet/material/date_picker.py
on_mount
¶
Subscribe to external value changes to keep the display in sync.
build
¶
build() -> Widget
Build the docked picker container with navigation header and calendar.
Source code in src/nuiitivet/material/date_picker.py
1357 1358 1359 1360 1361 1362 1363 1364 1365 1366 1367 1368 1369 1370 1371 1372 1373 1374 1375 1376 1377 1378 1379 1380 1381 1382 1383 1384 1385 1386 1387 1388 1389 1390 1391 1392 1393 1394 1395 1396 1397 1398 1399 1400 1401 1402 1403 1404 1405 1406 1407 1408 1409 1410 1411 1412 1413 1414 1415 1416 1417 1418 1419 1420 1421 1422 1423 1424 1425 1426 1427 1428 1429 1430 1431 1432 1433 1434 1435 1436 1437 1438 1439 1440 1441 1442 1443 1444 1445 1446 1447 1448 1449 1450 1451 1452 1453 1454 1455 1456 1457 1458 | |
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)
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.
See #230 <https://github.com/yuksblog/nuiitivet/issues/230>_ for tracking.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
init_value
|
Optional[date]
|
Pre-selected date shown when the picker opens. |
None
|
supporting_text
|
str
|
Small label shown at the top of the header (14pt). |
'Select date'
|
min_date
|
Optional[date]
|
Earliest selectable date. |
None
|
max_date
|
Optional[date]
|
Latest selectable date. |
None
|
style
|
Optional['ModalDatePickerStyle']
|
Visual style. Defaults to :class: |
None
|
Initialize ModalDatePicker.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
init_value
|
Optional[date]
|
Initial selected date. |
None
|
supporting_text
|
str
|
Small label shown at the top of the header (14pt). |
'Select date'
|
min_date
|
Optional[date]
|
Minimum selectable date. |
None
|
max_date
|
Optional[date]
|
Maximum selectable date. |
None
|
style
|
Optional['ModalDatePickerStyle']
|
Optional style override. |
None
|
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
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 | |
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)
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.
See #230 <https://github.com/yuksblog/nuiitivet/issues/230>_ for tracking.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
init_value
|
Optional[Tuple[date, date]]
|
Pre-selected date range as |
None
|
supporting_text
|
str
|
Small label shown at the top of the header (14pt). |
'Select range'
|
min_date
|
Optional[date]
|
Earliest selectable date. |
None
|
max_date
|
Optional[date]
|
Latest selectable date. |
None
|
style
|
Optional['ModalDateRangePickerStyle']
|
Visual style. Defaults to :class: |
None
|
Initialize ModalDateRangePicker.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
init_value
|
Optional[Tuple[date, date]]
|
Initial date range as (start, end) tuple. |
None
|
supporting_text
|
str
|
Small label shown at the top of the header (14pt). |
'Select range'
|
min_date
|
Optional[date]
|
Minimum selectable date. |
None
|
max_date
|
Optional[date]
|
Maximum selectable date. |
None
|
style
|
Optional['ModalDateRangePickerStyle']
|
Optional style override. |
None
|
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
1886 1887 1888 1889 1890 1891 1892 1893 1894 1895 1896 1897 1898 1899 1900 1901 1902 1903 1904 1905 1906 1907 1908 1909 1910 1911 1912 1913 1914 1915 1916 1917 1918 1919 1920 1921 1922 1923 1924 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 | |
ModalDateInput
¶
ModalDateInput(*, init_value: Optional[date] = None, supporting_text: str = 'Enter date', input_label: str = 'Date', date_format: str = 'mm/dd/yyyy', min_date: Optional[date] = None, max_date: Optional[date] = None, style: Optional['ModalDateInputStyle'] = 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.
See #230 <https://github.com/yuksblog/nuiitivet/issues/230>_ for tracking.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
init_value
|
Optional[date]
|
Optional initial date used to pre-populate the text field. |
None
|
supporting_text
|
str
|
Small label shown at the top of the header (14pt). |
'Enter date'
|
input_label
|
str
|
Label for the date text field. |
'Date'
|
date_format
|
str
|
Format hint shown as supporting text (e.g. |
'mm/dd/yyyy'
|
min_date
|
Optional[date]
|
Earliest acceptable date. |
None
|
max_date
|
Optional[date]
|
Latest acceptable date. |
None
|
style
|
Optional['ModalDateInputStyle']
|
Visual style. Defaults to :class: |
None
|
Initialize ModalDateInput.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
init_value
|
Optional[date]
|
Initial date to pre-populate the text field. |
None
|
supporting_text
|
str
|
Small label shown at the top of the header (14pt). |
'Enter date'
|
input_label
|
str
|
Text field label. |
'Date'
|
date_format
|
str
|
Format hint shown below the text field. |
'mm/dd/yyyy'
|
min_date
|
Optional[date]
|
Minimum acceptable date. |
None
|
max_date
|
Optional[date]
|
Maximum acceptable date. |
None
|
style
|
Optional['ModalDateInputStyle']
|
Optional style override. |
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
2116 2117 2118 2119 2120 2121 2122 2123 2124 2125 2126 2127 2128 2129 2130 2131 2132 2133 2134 2135 2136 2137 2138 2139 2140 2141 2142 2143 2144 2145 2146 2147 2148 2149 2150 2151 2152 2153 2154 2155 2156 2157 2158 2159 2160 2161 2162 2163 2164 2165 2166 2167 2168 2169 2170 2171 2172 2173 2174 2175 2176 2177 2178 2179 2180 2181 2182 2183 2184 2185 2186 2187 2188 2189 2190 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 | |
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)
Shared style base for the calendar-based date pickers (MD3 Expressive).
Holds the tokens consumed by the calendar widgets shared across
:class:DockedDatePickerStyle, :class:ModalDatePickerStyle and
:class:ModalDateRangePickerStyle (the calendar grid, day cells and the
month/year navigation header). Variant-specific selection views add their
own tokens in the respective subclass.
Defaults match the MD3 docked picker. Subclasses override the container and header dimensions for their variant.
copy_with
¶
Return a new style with the given fields overridden.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
**changes
|
Fields to override. |
{}
|
Returns:
| Type | Description |
|---|---|
_S
|
New style instance of the same type with applied changes. |
Source code in src/nuiitivet/material/styles/date_picker_style.py
DockedDatePickerStyle
dataclass
¶
DockedDatePickerStyle(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: DatePickerStyle
Style for :class:DockedDatePicker (inline calendar).
MD3 docked picker: 360×460dp container, Large corner rounding (16dp). Adds the month/year inline list-menu tokens to the shared calendar base.
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: DatePickerStyle
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
|
Fields to override. |
{}
|
Returns:
| Type | Description |
|---|---|
'ModalDateInputStyle'
|
New |
Source code in src/nuiitivet/material/styles/date_picker_style.py
Image
¶
Image(source: bytes | None | ReadOnlyObservableProtocol[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')
Bases: Widget
Display a raster image from in-memory bytes.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
source
|
bytes | None | ReadOnlyObservableProtocol[bytes | None]
|
Encoded image bytes, |
required |
fit
|
Fit
|
Content fit mode. One of |
'contain'
|
alignment
|
AlignmentLike
|
Content alignment in the allocated content rect. |
'center'
|
width
|
SizingLike
|
Width sizing. |
None
|
height
|
SizingLike
|
Height sizing. |
None
|
padding
|
int | tuple[int, int] | tuple[int, int, int, int]
|
Space around content. |
0
|
Initialize an Image widget.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
source
|
bytes | None | ReadOnlyObservableProtocol[bytes | None]
|
Encoded image bytes, |
required |
fit
|
Fit
|
Content fit mode. One of |
'contain'
|
width
|
SizingLike
|
Width sizing. |
None
|
height
|
SizingLike
|
Height sizing. |
None
|
padding
|
int | tuple[int, int] | tuple[int, int, int, int]
|
Space around content. |
0
|
alignment
|
AlignmentLike
|
Content alignment in the allocated content rect. |
'center'
|
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.