Skip to main content
239

Search Lumen

Find components, APIs, guides, and recipes.

GitHub
Themes
Apple docs
WidgetKitApple

Widget compact stat

Compose a compact WidgetKit label and value with optional semantic icon.

Public APILumenWidgetCompactStatApple / SwiftUISwift product: LumenWidgetUI

Apple availability

Supported native targets

Import LumenWidgetUI in the target that uses this component. iPad support follows the iOS package baseline and uses native iPad layout behavior.

iPhone · iOS 16+iPad · iPadOS 16+Mac · macOS 13+Apple Watch · watchOS 9+

Native example

Use Widget compact stat

Use for one compact label and value pair. Keep charts, timelines, and domain formatting application-owned.

Widget compact stat rendered in the iPhone simulator (WidgetKit Home Screen) Lumen playground
Captured exampleiPhone simulator (WidgetKit Home Screen)View dark appearance
swift
LumenWidgetCompactStat(
    label: .verbatim("Duration"),
    value: .verbatim("01:15"),
    iconSystemName: "timer"
)

Reference

Public API

The primary shared and platform-specific options exposed by LumenWidgetCompactStat.

APIValues or typeDefaultDescription
labelLumenWidgetTextContentRequiredNames the metric.
valueLumenWidgetTextContentRequiredProvides the formatted metric value.
iconSystemNameString?nilAdds a decorative semantic symbol.
toneLumenWidgetToneaccentSelects the value tone.
detailLumenWidgetTextContent?nilAdds supporting text below the metric.

Native behavior

Design and accessibility

When to use it

Use for one compact label and value pair. Keep charts, timelines, and domain formatting application-owned.

Accessibility

Label and value combine as one readable metric while native semantic fonts preserve accessibility text scaling.

Apple docsSwiftUI package