Skip to content
Filter Header preview
Rendered from the SwiftUI source on this page.

Filter Header

From syxUI — written for both platforms, not translated between them.

A results header with sort and filter controls.

Navigation · SwiftUI · iOS 17

  • navigation
  • swiftui

The actual source

HeaderFilter.swift
// Filter Header · syxUI · https://syxui.dev/components/hdr-filter
// Free in any project. Keep this line and credit syxUI where a person can read it.

import SwiftUI

let hdrBlue = Color(red: 0.0, green: 0.47, blue: 1.0)

// Filter/sort header row
struct HeaderFilter: View {
    var body: some View {
        HStack {
            Text("128 results").font(.system(size: 14)).foregroundStyle(.secondary)
            Spacer()
            HStack(spacing: 8) {
                Label("Sort", systemImage: "arrow.up.arrow.down").font(.system(size: 13, weight: .medium)).padding(.horizontal, 12).padding(.vertical, 7).overlay(Capsule().stroke(Color.primary.opacity(0.15)))
                Label("Filter", systemImage: "slider.horizontal.3").font(.system(size: 13, weight: .medium)).foregroundStyle(.white).padding(.horizontal, 12).padding(.vertical, 7).background(hdrBlue, in: Capsule())
            }
        }.frame(width: 340)
    }
}
iOS 17 · No dependencies

Dependencies

SwiftUI
No external dependencies

Requires iOS 17