SwiftUI Texts & Typography
Gradient typography, markdown links, localized inflection rules, typewriter animations, and SF font variants. (18 components available in Compot).
Text with Uneven Background & Gradient
Stylized display text with asymmetrical corner radiuses and mesh gradient background.
import SwiftUI
struct TextWithUnevenBackgroundGradient: View {
var body: some View {
Text("Hello, World!")
.foregroundStyle(.white)
.padding()
.background(.blue.gradient)
// ...
// Complete source code available in Compot Pro on the App Store.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
Text with Number Inflection Rules
Dynamic text demonstrating automatic localized pluralization syntax (^[(count) item](inflect: true)).
import SwiftUI
struct TextWithNumberInflectionRules: View {
var num0: Int = 0
var num1: Int = 1
var num2: Int = 2
var body: some View {
VStack(spacing: 8) {
Text("^[\(num0) Apple](inflect: true)")
Text("^[\(num1) Apple](inflect: true)")
Text("^[\(num2) Apple](inflect: true)")
Text("^[\(num0) Person](inflect: true)")
Text("^[\(num1) Person](inflect: true)")
Text("^[\(num2) Person](inflect: true)")
Text("^[\(num0) Mouse](inflect: true)")
Text("^[\(num1) Mouse](inflect: true)")
Text("^[\(num2) Mouse](inflect: true)")
}
}
}
#Preview {
TextWithNumberInflectionRules()
}Text with Markdown Links
Rich text demonstrating inline markdown links, bolding, italics, and custom link styling.
import SwiftUI
struct TextWithMarkdownLinks: View {
var body: some View {
Text("**[Terms of Service](https://docs.google.com/document/d/1Elo7_XJlsED5jwCVNLUmVEtjOgkW0rcFsRYPtDuPLlg/view)** and **[Privacy Policy](https://docs.google.com/document/d/1qCqehg-XP7ap-5VgnUSl80q2N0tDd1Qix81ilc0l0uk/view)**")
.font(.footnote)
.foregroundStyle(Color.accentColor)
}
}
#Preview {
TextWithMarkdownLinks()
}Text with Dashed Stroke
Decorative heading enclosed in a dashed border stroke.
import SwiftUI
struct TextWithDashedStroke: View {
var body: some View {
VStack {
Text("Drop your weapons!")
}
.padding()
// ...
// Complete source code available in Compot Pro on the App Store.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
Text System Default Variants
Showcase of standard San Francisco system font weights and designs.
import SwiftUI
struct TextSystemDefaultVariants: View {
var body: some View {
HStack(spacing: 16) {
VStack(alignment: .trailing) {
Text("Default")
.font(.system(size: 14, weight: .medium, design: .default))
Text("Upright")
.font(.system(size: 14, weight: .medium, design: .default))
.padding(.bottom, 4)
VStack(alignment: .trailing, spacing: 4) {
Text("Text")
.font(.system(size: 17, weight: .ultraLight, design: .default))
Text("Text")
.font(.system(size: 17, weight: .thin, design: .default))
Text("Text")
.font(.system(size: 17, weight: .light, design: .default))
Text("Text")
.font(.system(size: 17, weight: .regular, design: .default))
Text("Text")
.font(.system(size: 17, weight: .medium, design: .default))
Text("Text")
.font(.system(size: 17, weight: .semibold, design: .default))
Text("Text")
.font(.system(size: 17, weight: .bold, design: .default))
Text("Text")
.font(.system(size: 17, weight: .heavy, design: .default))
Text("Text")
.font(.system(size: 17, weight: .black, design: .default))
}
}
VStack(alignment: .trailing) {
Text("Default")
.font(.system(size: 14, weight: .medium, design: .default))
Text("Italic")
.font(.system(size: 14, weight: .medium, design: .default))
.padding(.bottom, 4)
VStack(alignment: .trailing, spacing: 4) {
Text("Text")
.font(.system(size: 17, weight: .ultraLight, design: .default))
.italic()
Text("Text")
.font(.system(size: 17, weight: .thin, design: .default))
.italic()
Text("Text")
.font(.system(size: 17, weight: .light, design: .default))
.italic()
Text("Text")
.font(.system(size: 17, weight: .regular, design: .default))
.italic()
Text("Text")
.font(.system(size: 17, weight: .medium, design: .default))
.italic()
Text("Text")
.font(.system(size: 17, weight: .semibold, design: .default))
.italic()
Text("Text")
.font(.system(size: 17, weight: .bold, design: .default))
.italic()
Text("Text")
.font(.system(size: 17, weight: .heavy, design: .default))
.italic()
Text("Text")
.font(.system(size: 17, weight: .black, design: .default))
.italic()
}
}
}
}
}
#Preview {
TextSystemDefaultVariants()
}Text System Monospace Variants
Showcase of SF Mono typography for code, data, and numeric readouts.
import SwiftUI
struct TextSystemMonospaceVariants: View {
var body: some View {
HStack(spacing: 16) {
VStack(alignment: .trailing) {
Text("Mono")
.font(.system(size: 14, weight: .medium, design: .default))
Text("Upright")
.font(.system(size: 14, weight: .medium, design: .default))
.padding(.bottom, 4)
VStack(alignment: .trailing, spacing: 4) {
Text("Text")
.font(.system(size: 17, weight: .ultraLight, design: .monospaced))
Text("Text")
.font(.system(size: 17, weight: .thin, design: .monospaced))
Text("Text")
.font(.system(size: 17, weight: .light, design: .monospaced))
Text("Text")
.font(.system(size: 17, weight: .regular, design: .monospaced))
Text("Text")
.font(.system(size: 17, weight: .medium, design: .monospaced))
Text("Text")
.font(.system(size: 17, weight: .semibold, design: .monospaced))
Text("Text")
.font(.system(size: 17, weight: .bold, design: .monospaced))
Text("Text")
.font(.system(size: 17, weight: .heavy, design: .monospaced))
Text("Text")
.font(.system(size: 17, weight: .black, design: .monospaced))
}
}
VStack(alignment: .trailing) {
Text("Mono")
.font(.system(size: 14, weight: .medium, design: .default))
Text("Italic")
.font(.system(size: 14, weight: .medium, design: .default))
.padding(.bottom, 4)
VStack(alignment: .trailing, spacing: 4) {
Text("Text")
.font(.system(size: 17, weight: .ultraLight, design: .monospaced))
.italic()
Text("Text")
.font(.system(size: 17, weight: .thin, design: .monospaced))
.italic()
Text("Text")
.font(.system(size: 17, weight: .light, design: .monospaced))
.italic()
Text("Text")
.font(.system(size: 17, weight: .regular, design: .monospaced))
.italic()
Text("Text")
.font(.system(size: 17, weight: .medium, design: .monospaced))
.italic()
Text("Text")
.font(.system(size: 17, weight: .semibold, design: .monospaced))
.italic()
Text("Text")
.font(.system(size: 17, weight: .bold, design: .monospaced))
.italic()
Text("Text")
.font(.system(size: 17, weight: .heavy, design: .monospaced))
.italic()
Text("Text")
.font(.system(size: 17, weight: .black, design: .monospaced))
.italic()
}
}
}
}
}
#Preview {
TextSystemMonospaceVariants()
}More SwiftUI Texts & Typography Components (12)
Browse additional texts & typography components from our library. Click through to view standalone source code and usage examples.
Text System Rounded Variants
Showcase of SF Pro Rounded typography for friendly, consumer-facing interfaces.
Text System Serif Variants
Showcase of New York serif typography for editorial and reading experiences.
Text Style Default Variants
Comprehensive typography hierarchy showcase (Large Title down to Caption 2).
Text Date Styling Options
Built-in date/time text formatting variants (relative, timer, date, offset).
Text Styling Default Options
Text transformation samples (strikethrough, underline, kerning, baseline offset).
Text Truncation Modes
Comparison of .head, .middle, and .tail text truncation behaviors.
Text with Gradient
Headline text masked with a multi-stop linear gradient fill.
Relative Date Text
Automatically updating relative time formatting (e.g. "2 hours ago", "in 3 days").
Text Sequence with Timer
Dynamic text that cycles through a sequence of strings automatically using a timer.
Text Typing & Retracting Animation
Typewriter effect that types out and deletes sentences with a blinking cursor.
Text Dissolve Animation
Smooth cross-fade transition cycling through different phrases.
Monospace Expandable Text
Monospaced code/log snippet with tap-to-expand card layout.