Modifiers are constructor parameters shared by all Nib views. They control layout, appearance, typography, effects, and animation. Every view inherits these parameters from the base View class.

import nib

nib.Text(
    "Hello",
    font=nib.Font.TITLE,            # Typography
    foreground_color=nib.Color.BLUE, # Appearance
    padding=16,                      # Layout
    shadow_radius=4,                 # Effects
    animation=nib.Animation.spring(),# Animation
)

Complete Modifier Table

Layout

Parameter Type Default Description Details
width float None Fixed width in points. Layout
height float None Fixed height in points. Layout
min_width float None Minimum width in points. Layout
min_height float None Minimum height in points. Layout
max_width float \| str None Maximum width in points, or "infinity". Layout
max_height float \| str None Maximum height in points, or "infinity". Layout
padding float \| dict None Inner spacing (inside background). Layout
margin float \| dict None Outer spacing (outside background). Layout

Appearance

Parameter Type Default Description Details
foreground_color Color \| str None Text and content color. Appearance
background Color \| str \| View None Background color or view. Appearance
fill Color \| str None Shape fill color. Appearance
stroke Color \| str None Shape stroke color. Appearance
stroke_width float None Shape stroke thickness. Appearance
opacity float None View transparency (0.0--1.0). Appearance
corner_radius float \| CornerRadius None Rounded corners in points. Appearance
clip_shape str \| View None Clip view to shape. Appearance
visible bool True Show or hide view entirely. Appearance

Typography

Parameter Type Default Description Details
font Font \| str None Font configuration. Typography
font_weight FontWeight \| str None Text weight. Typography

Effects

Parameter Type Default Description Details
shadow_color Color \| str None Drop shadow color. Effects
shadow_radius float None Drop shadow blur radius. Effects
shadow_x float None Drop shadow horizontal offset. Effects
shadow_y float None Drop shadow vertical offset. Effects
border_color Color \| str None Border color. Effects
border_width float None Border width in points. Effects
blend_mode BlendMode \| str None Layer blending mode. Effects
scale float None Scale transform factor. Effects
offset Offset None Position offset (x, y). Effects
animation Animation None Animation for property changes. Effects
content_transition ContentTransition \| str None How content changes animate. Effects
transition Transition \| str \| TransitionConfig None How view appears/disappears. Effects

Interaction

Parameter Type Default Description
on_drop Callable[[list[str]], None] None Callback for drag-and-drop file handling.
on_hover Callable[[bool], None] None Callback when mouse enters/exits the view.
on_click Callable[[], None] None Callback when the view is clicked.
tooltip str \| View None Tooltip text shown on hover.
overlay View None View rendered on top of this view.