Skip to content
Back to Top preview
Rendered from the SwiftUI source on this page.

Back to Top

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

A floating back-to-top pill.

Buttons · SwiftUI · iOS 17

  • buttons
  • swiftui

The actual source

ScrollTopButtonCard.swift
// Back to Top · syxUI · https://syxui.dev/components/btn-scroll-top
// Free in any project. Keep this line and credit syxUI where a person can read it.

import SwiftUI

// Floating back-to-top pill
struct ScrollTopButtonCard: View {
    var body: some View {
        HStack(spacing: 6) { Image(systemName: "arrow.up"); Text("Back to top") }.font(.system(size: 14, weight: .semibold)).foregroundStyle(.white).padding(.horizontal, 18).padding(.vertical, 11).background(Color.primary, in: Capsule()).shadow(color: .black.opacity(0.2), radius: 8, y: 4)
    }
}
iOS 17 · No dependencies

Dependencies

SwiftUI
No external dependencies

Requires iOS 17