SPB Git

Repository Public MIT

example-glass-text-area.txt 1.2 KB 36 lines text

1import SwiftUI2import SPGlassKit34public struct GlassTextAreaExample: GlassExample {5    public static let componentID = "glass-text-area"6    @State private var notes = ""7    @State private var bio = "Hiking 🥾, bread 🍞 and old maps 🗺️."8    @State private var feedback = "Too short"910    public init() {}1112    public var body: some View {13        ScrollView {14            VStack(alignment: .leading, spacing: 20) {15                GlassTextArea("Notes", text: $notes, placeholder: "Anything the team should know before the visit", helper: "Visible to your team only.")1617                GlassTextArea("Short bio", text: $bio, limit: 40)1819                GlassTextArea(20                    "Feedback",21                    text: $feedback,22                    showsCounter: true,23                    minHeight: 72,24                    errorMessage: feedback.count < 20 ? "Please write at least 20 characters." : nil25                )2627                GlassTextArea("Archived comment", text: .constant("This comment can no longer be edited."))28                    .disabled(true)29            }30            .padding()31        }32    }33}3435#Preview("GlassTextArea") { GlassTextAreaExample().glassTheme(.solar) }36
Files main
Menu

Theme