Autumn Sale50% offCOMPOT

SwiftUI Inputs & Text Editors

Clean multi-line TextEditors and floating placeholder text containers. (2 components available in Compot).

1 of 2Free ComponentiOS 16.0+

Text Editor Simple

Clean multi-line TextEditor with standard border styling.

View Component & Details
TextEditorSimple.swift
import SwiftUI

struct TextEditorSimple: View {
    
    @State private var text: String = ""
    @FocusState private var focusText: Bool
    
    var body: some View {
        VStack(alignment: .leading, spacing: 4) {
            Text("Text Editor")
                .font(.callout)
                .foregroundStyle(.secondary)
                .font(.system(size: 15, weight: .regular, design: .default))
            TextEditor(text: $text)
                .focused($focusText)
                .autocorrectionDisabled()
                .textSelection(.enabled)
                .padding(.horizontal, 8)
                .padding(.vertical, 4)
                .foregroundStyle(.primary)
                .font(.system(size: 15, weight: .regular, design: .default))
                .lineSpacing(2)
                .overlay(RoundedRectangle(cornerRadius: 8).stroke(Color(uiColor: .tertiarySystemFill), lineWidth: 1.5))
        }
        .padding()
        .frame(maxWidth: .infinity, maxHeight: 150)
        .toolbar {
            ToolbarItemGroup(placement: .keyboard) {
                Spacer()
                Button("Hide keyboard") {
                    focusText = false
                }
            }
        }
    }
}

#Preview {
    TextEditorSimple()
}
2 of 2Pro ComponentiOS 16.0+

TextEditor with Placeholder & Custom Background

Enhanced TextEditor with floating placeholder support and custom background container.

View Component & Details
TexteditorWithPlaceholderCustomBackground.swift
Unlock in App
import SwiftUI

struct TextEditorWPlaceholderCustomBackground: View {
    
    @State private var text: String = ""
    @FocusState private var isFocused: Bool
    
    var body: some View {

        // ...
        // Complete source code available in Compot Pro on the App Store.
Compot Pro Component

Unlock full code & interactive preview

Interactive live preview and complete SwiftUI code available in the Compot App.

Available for macOS & iOS • 85+ free components included