KPIHeader
KPIHeader
is used to display KPIItem and KPIProgressItem.
The maximum number of items that can be displayed in the header is 4. If more than 4 items are provided, then only first 4 items are displayed and the rest will be ignored.
If the item is KPIProgressItem and the value of its property chartSize
is .small
, it will not be displayed, too.
Usage
var data: [KPIHeaderItemModel] = [
KPIItem(kpiCaption: "small", items: [KPISubItemModelImpl(kPISubItemValue: .text("123"), kPISubItemType: .metric)], proposedViewSize: .small, alignment: .center),
KPIProgressItem(kpiCaption: "Downloading", data: .constant(KPIItemData.percent(0.65))),
KPIItem(kpiCaption: "Big caption and long text", items: [KPISubItemModelImpl(kPISubItemValue: .text("321"), kPISubItemType: .metric)], proposedViewSize: .large, alignment: .center),
KPIProgressItem(kpiCaption: "Completed", data: .constant(KPIItemData.percent(1.0)), chartSize: .small)]
KPIHeader(items: data, isItemOrderForced: false)
Sets the separator for kpi header components Example usage:
KPIHeader(...)
.headerSeparator(true) // Show separator with default style
.headerSeparator(true, color: .red) // Show red separator
.headerSeparator(true, color: .blue, lineWidth: 1.0) // Show thick blue separator
.headerSeparator(false) // Hide separator
-
Undocumented
Declaration
Swift
public init(@ViewBuilder items: () -> any View = { EmptyView() }, @ViewBuilder bannerMessage: () -> any View = { EmptyView() }, isItemOrderForced: Bool = false, interItemSpacing: CGFloat? = nil, isPresented: Binding<Bool>, componentIdentifier: String? = KPIHeader.identifier)
-
Undocumented
Declaration
Swift
static let identifier: String
-
Undocumented
Declaration
Swift
init(items: [any KPIHeaderItemModel] = [], bannerMessage: BannerMessage? = nil, isItemOrderForced: Bool = false, interItemSpacing: CGFloat? = nil, isPresented: Binding<Bool>)
-
Undocumented
Declaration
Swift
init(_ configuration: KPIHeaderConfiguration)
-
Declaration
Swift
@MainActor public var body: some View { get }
-
Undocumented
Declaration
Swift
public var isEmpty: Bool { get }