Enums¶
Nib's enums are string enums importable from nib, for example nib.ButtonStyle.BORDERED. Each member's value is the string sent to the runtime, and every parameter that takes an enum also accepts that string, so style="bordered" and style=nib.ButtonStyle.BORDERED are equivalent.
The enums on this page fall into four groups:
- Alignment: HorizontalAlignment, VerticalAlignment, Alignment, ScrollAxis
- Image and text: SymbolScale, SymbolRenderingMode, ContentMode, TruncationMode, TextCase
- Style: ButtonStyle, ButtonRole, BorderShape, ControlSize, LabelStyle, ToggleStyle, TextFieldStyle, EditorStyle, PickerStyle, ProgressStyle, FormStyle
- Blend: BlendMode
FontWeight and FontDesign are on the Font page. Transition and ContentTransition are on the Transition page.
HorizontalAlignment¶
Taken by the alignment parameter of VStack and LazyVGrid.
| Member | Value | Description |
|---|---|---|
LEADING |
"leading" |
Align children to the leading edge (left in left-to-right languages). |
CENTER |
"center" |
Center children horizontally (default). |
TRAILING |
"trailing" |
Align children to the trailing edge (right in left-to-right languages). |
VerticalAlignment¶
Taken by the alignment parameter of HStack, LazyHGrid and GridRow (Grid).
| Member | Value | Description |
|---|---|---|
TOP |
"top" |
Align children to the top edge. |
CENTER |
"center" |
Center children vertically (default). |
BOTTOM |
"bottom" |
Align children to the bottom edge. |
Alignment¶
Two-dimensional alignment, taken by the alignment parameter of ZStack, Grid and GridItem (LazyVGrid and LazyHGrid). The text_alignment field of TextEditorStyle (TextEditor) takes LEADING, CENTER or TRAILING.
| Member | Value | Description |
|---|---|---|
TOP_LEADING |
"topLeading" |
Top leading corner. |
TOP |
"top" |
Top edge, centered horizontally. |
TOP_TRAILING |
"topTrailing" |
Top trailing corner. |
LEADING |
"leading" |
Leading edge, centered vertically. |
CENTER |
"center" |
Center (default). |
TRAILING |
"trailing" |
Trailing edge, centered vertically. |
BOTTOM_LEADING |
"bottomLeading" |
Bottom leading corner. |
BOTTOM |
"bottom" |
Bottom edge, centered horizontally. |
BOTTOM_TRAILING |
"bottomTrailing" |
Bottom trailing corner. |
The example shows VerticalAlignment in an HStack and Alignment in a ZStack.

import nib
def main(app: nib.App):
app.title = "Alignment"
app.icon = nib.SFSymbol("align.horizontal.left")
app.width = 340
app.height = 300
def box(color, w=28, h=28):
return nib.Rectangle(fill=color, corner_radius=4, width=w, height=h)
def hstack(alignment):
return nib.HStack(
controls=[
box("#0a84ff", 20, 40),
box("#30d158", 20, 20),
box("#ff9f0a", 20, 30),
],
alignment=alignment,
spacing=6,
)
def zstack(alignment):
return nib.ZStack(
controls=[box("#3a3a3c", 60, 44), box("#ff453a", 14, 14)],
alignment=alignment,
)
def labelled(text, view):
return nib.VStack(
controls=[
view,
nib.Text(
text, font=nib.Font.CAPTION2, foreground_color=nib.Color.SECONDARY
),
],
spacing=4,
)
app.build(
nib.VStack(
controls=[
nib.Text("VerticalAlignment in an HStack", font=nib.Font.CAPTION),
nib.HStack(
controls=[
labelled("TOP", hstack(nib.VerticalAlignment.TOP)),
labelled("CENTER", hstack(nib.VerticalAlignment.CENTER)),
labelled("BOTTOM", hstack(nib.VerticalAlignment.BOTTOM)),
],
spacing=20,
),
nib.Text("Alignment in a ZStack", font=nib.Font.CAPTION),
nib.HStack(
controls=[
labelled("TOP_LEADING", zstack(nib.Alignment.TOP_LEADING)),
labelled("CENTER", zstack(nib.Alignment.CENTER)),
labelled(
"BOTTOM_TRAILING", zstack(nib.Alignment.BOTTOM_TRAILING)
),
],
spacing=20,
),
],
spacing=10,
padding=20,
alignment=nib.HorizontalAlignment.LEADING,
)
)
nib.run(main)
ScrollAxis¶
Taken by the axes parameter of ScrollView.
| Member | Value | Description |
|---|---|---|
VERTICAL |
"vertical" |
Scroll vertically (default). |
HORIZONTAL |
"horizontal" |
Scroll horizontally. |
BOTH |
"both" |
Scroll in both directions. |
MenuItemState¶
Taken by the state parameter of MenuItem.
| Member | Value | Description |
|---|---|---|
ON |
"on" |
A checkmark. |
OFF |
"off" |
Nothing. |
MIXED |
"mixed" |
A dash. |
SymbolScale¶
Taken by the scale parameter of SFSymbol. It sets the symbol's size relative to the surrounding font.
| Member | Value | Description |
|---|---|---|
SMALL |
"small" |
Smaller than the font size. |
MEDIUM |
"medium" |
Matches the font size (default). |
LARGE |
"large" |
Larger than the font size. |
SymbolRenderingMode¶
Taken by the rendering_mode parameter of SFSymbol.
| Member | Value | Description |
|---|---|---|
MONOCHROME |
"monochrome" |
Every layer in the foreground color. |
HIERARCHICAL |
"hierarchical" |
Layers in the foreground color at decreasing opacity. |
PALETTE |
"palette" |
A separate color for each layer. |
MULTICOLOR |
"multicolor" |
The symbol's built-in colors. |
ContentMode¶
Taken by the aspect_ratio parameter of Image.
| Member | Value | Description |
|---|---|---|
FIT |
"fit" |
Scale to fit inside the frame, keeping the aspect ratio. The whole image is visible. |
FILL |
"fill" |
Scale to fill the frame, keeping the aspect ratio. Parts of the image can be clipped. |
TruncationMode¶
Taken by the truncation_mode parameter of Text. It sets where text is cut when it does not fit, usually together with line_limit.
| Member | Value | Description |
|---|---|---|
HEAD |
"head" |
Truncate at the start: ...end of text. |
MIDDLE |
"middle" |
Truncate in the middle: start...end. |
TAIL |
"tail" |
Truncate at the end: start of text... (default). |
TextCase¶
Taken by the text_case parameter of Text. It changes how the text is displayed, not the content value.
| Member | Value | Description |
|---|---|---|
UPPERCASE |
"uppercase" |
Display in uppercase. |
LOWERCASE |
"lowercase" |
Display in lowercase. |
The example shows ContentMode, SymbolScale, SymbolRenderingMode, TruncationMode and TextCase.

import nib
def main(app: nib.App):
app.title = "Image enums"
app.icon = nib.SFSymbol("photo.artframe")
app.width = 340
app.height = 330
photo = "https://picsum.photos/id/1011/300/400"
def labelled(text, view):
return nib.VStack(
controls=[
view,
nib.Text(
text, font=nib.Font.CAPTION2, foreground_color=nib.Color.SECONDARY
),
],
spacing=4,
)
app.build(
nib.VStack(
controls=[
nib.HStack(
controls=[
labelled(
"ContentMode.FIT",
nib.Image(
src=photo,
aspect_ratio=nib.ContentMode.FIT,
width=120,
height=80,
background="#3a3a3c",
corner_radius=6,
),
),
labelled(
"ContentMode.FILL",
nib.Image(
src=photo,
aspect_ratio=nib.ContentMode.FILL,
width=120,
height=80,
corner_radius=6,
),
),
],
spacing=16,
),
nib.HStack(
controls=[
labelled(
"SymbolScale.SMALL",
nib.SFSymbol(
"sun.max.fill", scale="small", font=nib.Font.system(22)
),
),
labelled(
"LARGE",
nib.SFSymbol(
"sun.max.fill", scale="large", font=nib.Font.system(22)
),
),
labelled(
"MULTICOLOR",
nib.SFSymbol(
"sun.max.fill",
rendering_mode=nib.SymbolRenderingMode.MULTICOLOR,
font=nib.Font.system(22),
),
),
],
spacing=16,
),
nib.Text(
"TruncationMode.MIDDLE: Report 2026 final version.pdf",
line_limit=1,
truncation_mode=nib.TruncationMode.MIDDLE,
width=280,
),
nib.Text(
"TruncationMode.TAIL: Report 2026 final version.pdf",
line_limit=1,
truncation_mode=nib.TruncationMode.TAIL,
width=280,
),
nib.Text(
"TextCase.UPPERCASE",
text_case=nib.TextCase.UPPERCASE,
font=nib.Font.CAPTION,
),
],
spacing=12,
padding=20,
alignment=nib.HorizontalAlignment.LEADING,
)
)
nib.run(main)
ButtonStyle¶
Taken by the style parameter of Button.
| Member | Value | Description |
|---|---|---|
AUTOMATIC |
"automatic" |
System default style. |
BORDERED |
"bordered" |
Button with a visible border. |
BORDERED_PROMINENT |
"borderedProminent" |
Bordered button filled with the accent color. |
BORDERLESS |
"borderless" |
No visible border. |
PLAIN |
"plain" |
Minimal styling. |
LINK |
"link" |
Drawn as a clickable link. |
ButtonRole¶
Taken by the role parameter of Button.
| Member | Value | Description |
|---|---|---|
DESTRUCTIVE |
"destructive" |
A destructive action, drawn in red. |
CANCEL |
"cancel" |
A cancel action. |
BorderShape¶
Taken by the border_shape parameter of Button.
| Member | Value | Description |
|---|---|---|
AUTOMATIC |
"automatic" |
System default shape. |
CAPSULE |
"capsule" |
Pill-shaped border. |
ROUNDED_RECTANGLE |
"roundedRectangle" |
Rounded rectangle border. |
CIRCLE |
"circle" |
Circular border. |
ControlSize¶
Taken by the control_size parameter of Button.
| Member | Value | Description |
|---|---|---|
MINI |
"mini" |
Smallest size. |
SMALL |
"small" |
Small size. |
REGULAR |
"regular" |
Default size. |
LARGE |
"large" |
Large size. |
EXTRA_LARGE |
"extraLarge" |
Largest size. |
LabelStyle¶
Taken by the style parameter of Label and the label_style parameter of Button.
| Member | Value | Description |
|---|---|---|
AUTOMATIC |
"automatic" |
System default. |
ICON_ONLY |
"iconOnly" |
Show only the icon. |
TITLE_ONLY |
"titleOnly" |
Show only the title. |
TITLE_AND_ICON |
"titleAndIcon" |
Show the title and the icon. |
ToggleStyle¶
Taken by the style parameter of Toggle.
| Member | Value | Description |
|---|---|---|
AUTOMATIC |
"automatic" |
System default style. |
SWITCH |
"switch" |
Switch control. |
BUTTON |
"button" |
Button that stays pressed while on. |
CHECKBOX |
"checkbox" |
Checkbox. |
TextFieldStyle¶
Taken by the style parameter of TextField and SecureField.
| Member | Value | Description |
|---|---|---|
AUTOMATIC |
"automatic" |
System default style. |
PLAIN |
"plain" |
No border or background. |
ROUNDED_BORDER |
"roundedBorder" |
Rounded border with a background. |
SQUARE_BORDER |
"squareBorder" |
Square border with a background. |
EditorStyle¶
Taken by the editor_style field of TextEditorStyle, which goes in the style parameter of TextEditor: nib.TextEditor(value="", style=nib.TextEditorStyle(editor_style=nib.EditorStyle.PLAIN)). Requires macOS 14.
| Member | Value | Description |
|---|---|---|
AUTOMATIC |
"automatic" |
System default style. |
PLAIN |
"plain" |
No border or background. |
PickerStyle¶
Taken by the style parameter of Picker.
| Member | Value | Description |
|---|---|---|
AUTOMATIC |
"automatic" |
System default style. |
MENU |
"menu" |
Dropdown menu. |
SEGMENTED |
"segmented" |
Segmented control. |
WHEEL |
"wheel" |
Scrolling wheel. |
INLINE |
"inline" |
Options listed inline. |
ProgressStyle¶
Taken by the style parameter of ProgressView.
| Member | Value | Description |
|---|---|---|
AUTOMATIC |
"automatic" |
System default style. |
LINEAR |
"linear" |
Horizontal bar. |
CIRCULAR |
"circular" |
Circular indicator. |
FormStyle¶
Taken by the style parameter of Form.
| Member | Value | Description |
|---|---|---|
AUTOMATIC |
"automatic" |
Platform default style. |
COLUMNS |
"columns" |
Two columns, labels on the left and controls on the right (the macOS default). |
GROUPED |
"grouped" |
Grouped sections with visual separation. |
A form that uses several style enums:
import nib
nib.Form(
controls=[
nib.TextField(
placeholder="Name", value="", style=nib.TextFieldStyle.ROUNDED_BORDER
),
nib.Toggle("Notifications", is_on=True, style=nib.ToggleStyle.SWITCH),
nib.Picker(
"Theme",
options=["Light", "Dark"],
selection="Light",
style=nib.PickerStyle.SEGMENTED,
),
nib.Button(
"Delete account",
on_click=lambda: None,
style=nib.ButtonStyle.BORDERED,
role=nib.ButtonRole.DESTRUCTIVE,
control_size=nib.ControlSize.LARGE,
),
],
style=nib.FormStyle.GROUPED,
)
BlendMode¶
Taken by the blend_mode modifier, which every view accepts, and by the blend_mode parameter of the draw commands Rect, Circle, Ellipse and Fill. It sets how the view is composited with the content behind it.
| Member | Value | Description |
|---|---|---|
NORMAL |
"normal" |
No blending (default). The view covers the content behind it. |
MULTIPLY |
"multiply" |
Multiplies source and destination colors. The result is darker. |
SCREEN |
"screen" |
Inverts, multiplies, and inverts again. The result is lighter. |
OVERLAY |
"overlay" |
Multiply on dark areas, screen on light areas. |
DARKEN |
"darken" |
The darker of source and destination, per channel. |
LIGHTEN |
"lighten" |
The lighter of source and destination, per channel. |
COLOR_DODGE |
"colorDodge" |
Brightens the destination to reflect the source. |
COLOR_BURN |
"colorBurn" |
Darkens the destination to reflect the source. |
SOFT_LIGHT |
"softLight" |
A softer version of overlay. |
HARD_LIGHT |
"hardLight" |
Overlay with source and destination swapped. |
DIFFERENCE |
"difference" |
Subtracts the darker color from the lighter one. |
EXCLUSION |
"exclusion" |
Like difference, with lower contrast. |
HUE |
"hue" |
Hue of the source, saturation and luminosity of the destination. |
SATURATION |
"saturation" |
Saturation of the source, hue and luminosity of the destination. |
COLOR |
"color" |
Hue and saturation of the source, luminosity of the destination. |
LUMINOSITY |
"luminosity" |
Luminosity of the source, hue and saturation of the destination. |
Two overlapping circles, the second blended with SCREEN:
import nib
nib.ZStack(
controls=[
nib.Circle(fill=nib.Color.RED, width=120, height=120),
nib.Circle(
fill=nib.Color.BLUE,
width=120,
height=120,
offset=nib.Offset(40, 0),
blend_mode=nib.BlendMode.SCREEN,
),
],
)
Related¶
- Layout: stacks, grids and scroll views that take the alignment enums
- Button, Toggle, Picker, TextField: controls that take the style enums
- Image, SFSymbol, Text: views that take the image and text enums
- Effect modifiers:
blend_mode - Font:
FontWeight,FontDesign - Transition:
Transition,ContentTransition