ExpandableText
Expand the text with the "more" button.(SwiftUI)
Install / Use
/learn @NuPlay/ExpandableTextREADME
Get Started
import SwiftUI
import ExpandableText
struct ExpandableText_Test: View {
@State private var sampleText: String = "Do you think you're living an ordinary life? You are so mistaken it's difficult to even explain. The mere fact that you exist makes you extraordinary. The odds of you existing are less than winning the lottery, but here you are. Are you going to let this extraordinary opportunity pass?"
var body: some View {
ExpandableText(text: sampleText)
.font(.body)//optional
.foregroundColor(.primary)//optional
.lineLimit(3)//optional
.expandButton(TextSet(text: "more", font: .body, color: .blue))//optional
.collapseButton(TextSet(text: "less", font: .body, color: .blue))//optional
.expandAnimation(.easeOut)//optional
.padding(.horizontal, 24)//optional
}
}
Modifier(optional)
Modifier | Default
--- | ---
.font(_ font: Font) | .body
.lineLimit(_ lineLimit: Int) | 3
.foregroundColor(_ color: Color) | .primary
.expandButton(_ expandButton: TextSet) | TextSet(text: "more", font: .body, color: .blue)
.collapseButton(_ collapseButton: TextSet?) | nil(If it's nil, it doesn't show)
.expandAnimation(_ animation: Animation?) | .none
Related Skills
node-connect
344.4kDiagnose OpenClaw node connection and pairing failures for Android, iOS, and macOS companion apps
frontend-design
99.2kCreate distinctive, production-grade frontend interfaces with high design quality. Use this skill when the user asks to build web components, pages, or applications. Generates creative, polished code that avoids generic AI aesthetics.
openai-whisper-api
344.4kTranscribe audio via OpenAI Audio Transcriptions API (Whisper).
qqbot-media
344.4kQQBot 富媒体收发能力。使用 <qqmedia> 标签,系统根据文件扩展名自动识别类型(图片/语音/视频/文件)。
