Skip to content
Status Select preview
Rendered from the SwiftUI source on this page.

Status Select

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

A status menu with colored dots.

Navigation · SwiftUI · iOS 17

  • navigation
  • swiftui

The actual source

MenuStatus.swift
// Status Select · syxUI · https://syxui.dev/components/menu-status
// Free in any project. Keep this line and credit syxUI where a person can read it.

import SwiftUI

let mnBlue = Color(red: 0.0, green: 0.47, blue: 1.0)
let mnRed = Color(red: 0.90, green: 0.24, blue: 0.28)

func menuCard<C: View>(_ w: CGFloat, @ViewBuilder _ c: () -> C) -> some View {
    c().frame(width: w).background(Color(.systemBackground), in: RoundedRectangle(cornerRadius: 14, style: .continuous)).overlay(RoundedRectangle(cornerRadius: 14, style: .continuous).stroke(Color.primary.opacity(0.07), lineWidth: 1)).shadow(color: .black.opacity(0.06), radius: 14, y: 5)
}

struct MenuStatus: View { var body: some View { menuCard(220) { VStack(spacing: 0) { ForEach(Array([("Active", Color(red: 0.16, green: 0.66, blue: 0.40)), ("Away", Color(red: 0.98, green: 0.55, blue: 0.10)), ("Busy", mnRed), ("Offline", Color.gray)].enumerated()), id: \.offset) { i, s in HStack(spacing: 10) { Circle().fill(s.1).frame(width: 9, height: 9); Text(s.0).font(.system(size: 15)); Spacer(); if i == 0 { Image(systemName: "checkmark").font(.system(size: 13, weight: .semibold)).foregroundStyle(mnBlue) } }.padding(.horizontal, 14).padding(.vertical, 10); if i < 3 { Divider() } } } } } }
iOS 17 · No dependencies

Dependencies

SwiftUI
No external dependencies

Requires iOS 17