swiftcnearly preview

Arbitrary arguments

Use explicit points, colors, transforms, and animation timing.

Use Tailwind's bracket notation to supply values outside the theme scale.

Text("Room for ideas")
    .tw("text-[22] tracking-[0.3] p-[24] w-[360] rounded-[22] bg-[#6366f1] text-[#fff]")
    .tw("hover:scale-[1.02] animate-smooth duration-[220ms]")

Supported values

ClassesArguments
w-[240], h-[80], size-[44]Width, height, or both dimensions
min-w-[80], max-w-[300], min-h-[44], max-h-[200]Native size limits
p-[13], px-[12], py-[8], pt-[4], pb-[4], ps-[4], pe-[4]Padding in native points
rounded-[14], border-[1.5]Corner radius or border width
text-[18], text-[length:18px]Fixed native font size in points
text-[#fff], bg-[#6366f1], border-[color:#6366f180]Hex colors in RGB or RGBA order
text-[color:brand], bg-[brand], border-[color:brand]Registered adaptive theme colors
opacity-[0.8]Native opacity from zero to one
tracking-[0.5], tracking-[-0.5]Character tracking on a native Text value
line-spacing-[4]Native gap between text lines in points
line-clamp-[2], line-clamp-2, line-clamp-noneNative line limit or removal of the inherited limit
text-start, text-center, text-endNative multiline text alignment
offset-[12,-4]Horizontal and vertical offsets in points
scale-[1.05], scale-[1.1,0.9]Uniform or separate horizontal and vertical scale factors
rotate-[3deg], rotate-[0.05rad]Rotation in degrees or radians
blur-[2]Native blur radius in points
duration-[400], duration-[400ms], duration-[0.4s], delay-[75ms]Animation timing

Units and typography

Bare bracket lengths use native points. The pt and px suffixes also represent native points. For example, w-12 follows the theme scale; w-[48] always uses 48 points. Bare bracket timing values use milliseconds. Bare rotation values use degrees.

Size tokens such as text-lg retain scalable SwiftUI font roles. Explicit font sizes such as text-[18] use a fixed native font size. Native line spacing controls the gap between lines; CSS line height needs a separate mapping.

Apply tracking directly to Text, before modifiers that wrap it in another view. Other views keep their normal rendering and log a diagnostic for an unsupported tracking target. Unspecified text attributes preserve native inheritance.

Parsing and validation

State variants, group variants, named classes, and local overrides also accept bracket values. Colons inside brackets belong to the argument. Underscores represent spaces; \_ preserves a literal underscore. Use comma-separated scalar values for offset and scale arguments. Numeric helpers reject invalid numbers, unsupported units, and nonfinite values. Percentages, rem, calc, and CSS variables have no native mappings and fail validation.

Try the class editor

The native Arguments demo accepts a live class string. It shows unsupported classes and invalid values beside the preview.

Native Arguments demo with class input, validation, and a styled preview.Native Arguments demo with class input, validation, and a styled preview. Dark appearance.
Captured from the native SwiftUI catalog on macOS.

Extend the vocabulary with custom utility factories.

Use native modifier plugins when a registered class should produce a real SwiftUI modifier.

On this page