DropletGlassTabBar
Droppy's one sliding glass bar, for a droplet (DroppyKit 1.30.0): macOS's own segmented control, whose segments light under the pointer and whose Liquid Glass bubble slides between them while you press and drag, the bar at the foot of Droppy's Command Center, About and Theming.
@MainActor struct DropletGlassTabBar<ID> where ID : Hashable
Inside Droppy it is that bar itself, drawn by the host (badges, the glass backdrop for a bar floating over content, scrolling when the segments outgrow the room); in the harness and previews it is the same native control through droppyNativeSegmentedPickerStyle(size:tint:). A nil selection lights no segment, for a bar whose segments open something.
DropletGlassTabBar("Section", items: [
DropletGlassTabBarItem(id: Section.today, title: "Today", systemImage: "sun.max.fill"),
DropletGlassTabBarItem(id: Section.week, title: "This week", systemImage: "calendar"),
DropletGlassTabBarItem(id: Section.inbox, title: "Inbox", systemImage: "tray.fill", badge: unread),
], selection: $section)On the shelf, a mode switch in a widget's header may be this bar at size: .header (28pt, Droppy's Calculator and Agents); a choice in a widget's body is DroppyWashChoiceButtonStyle's pills. A switch of words in a Settings row is a Picker with droppyNativeSegmentedPickerStyle(size:tint:).
Available from DroppyKit 1.30.0; it needs a Droppy that embeds 1.30.0.
Initializers
init(_:items:selection:size:floatsOverContent:)
@MainActor init(_ title: String, items: [DropletGlassTabBarItem<ID>], selection: Binding<ID?>, size: DroppySegmentedPickerSize = .toolbar, floatsOverContent: Bool = false)
Creates the bar.
- Parameters:
- title: What the bar switches, for VoiceOver ("Section").
- items: The segments, leading to trailing.
- selection: The chosen segment, or
nilfor none. - size: The height tier, the height of the buttons beside it:
.toolbar36pt (a panel's or a page's bar),.header28pt,.compact24pt. - floatsOverContent: The bar floats over art or content (a panel's foot): Droppy puts a Liquid Glass capsule behind it.
Properties
body
@MainActor var body: some View { get }