Skip to content
Floating Button preview
Rendered from the SwiftUI source on this page.

Floating Button

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

A single floating action button with a shadow.

Buttons · SwiftUI · iOS 17

  • buttons
  • swiftui

The actual source

FabSingleCard.swift
// Floating Button · syxUI · https://syxui.dev/components/btn-fab-single
// Free in any project. Keep this line and credit syxUI where a person can read it.

import SwiftUI

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

// Single floating action button
struct FabSingleCard: View {
    var body: some View {
        Image(systemName: "plus").font(.system(size: 24, weight: .semibold)).foregroundStyle(.white).frame(width: 60, height: 60).background(btnBlue, in: Circle()).shadow(color: btnBlue.opacity(0.4), radius: 12, y: 6)
    }
}
iOS 17 · No dependencies

Dependencies

SwiftUI
No external dependencies

Requires iOS 17