Skip to content
Radio Menu preview
Rendered from the SwiftUI source on this page.

Radio Menu

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

A single-select radio menu.

Navigation · SwiftUI · iOS 17

  • navigation
  • swiftui

The actual source

MenuRadio.swift
// Radio Menu · syxUI · https://syxui.dev/components/menu-radio
// 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)

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 MenuRadio: View { var body: some View { menuCard(240) { VStack(spacing: 0) { ForEach(Array([("Name", true), ("Date modified", false), ("Size", false)].enumerated()), id: \.offset) { i, o in HStack { Image(systemName: o.1 ? "largecircle.fill.circle" : "circle").font(.system(size: 16)).foregroundStyle(o.1 ? mnBlue : .secondary); Text(o.0).font(.system(size: 15)); Spacer() }.padding(.horizontal, 12).padding(.vertical, 11); if i < 2 { Divider() } } } } } }
iOS 17 · No dependencies

Dependencies

SwiftUI
No external dependencies

Requires iOS 17