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.
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.
TexteditorWithPlaceholderCustomBackground.swiftPro
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
Explore other SwiftUI categories
Buttons (34)Texts & Typography (18)Banners & Promos (10)Cards & Content Displays (8)Settings, Lists & Rows (9)Avatars & User Profiles (7)Charts & Gauges (5)Icons & Badges (7)Links & Sharing (5)Navigation Links & Banners (3)Onboarding & Welcome Screens (3)Paywalls & Subscriptions (3)Images & Effects (3)Labels (4)SF Symbols & Animations (4)Shapes, Chat & Real-Time (2)Tiles & Selectables (2)Badges & Pills (1)Alerts & Modals (1)Toasts & Feedback (1)Developer Templates & Architecture (3)