mirror of
https://github.com/phranck/TUIkit.git
synced 2026-06-20 09:54:37 +00:00
- Rename module, targets and products in Package.swift - Rename directories: Sources/TUIkit, TUIkitExample, Tests/TUIkitTests - Rename files: TUIkit.swift, TUIkit.docc/TUIkit.md - Update all import statements, module-qualified calls, file headers - Update doc comments, string literals and DocC articles - Update CI workflow, README, .swiftlint.yml and markdown docs - Merge platform badges into single combined badge in README - Add "Example App auslagern" task to to-dos.md
74 lines
2.1 KiB
Swift
74 lines
2.1 KiB
Swift
//
|
|
// ButtonsPage.swift
|
|
// TUIkitExample
|
|
//
|
|
// Demonstrates button and focus system capabilities.
|
|
//
|
|
|
|
import TUIkit
|
|
|
|
/// Buttons and focus demo page.
|
|
///
|
|
/// Shows interactive button features including:
|
|
/// - Different button styles (default, primary, success, destructive)
|
|
/// - Disabled buttons
|
|
/// - Plain style (no border)
|
|
/// - ButtonRow for horizontal groups
|
|
/// - Focus navigation with Tab
|
|
struct ButtonsPage: View {
|
|
var body: some View {
|
|
VStack(spacing: 1) {
|
|
HeaderView(title: "Buttons & Focus Demo")
|
|
|
|
DemoSection("Button Styles") {
|
|
HStack(spacing: 2) {
|
|
Button("Default") {
|
|
// Default style button action
|
|
}
|
|
Button("Primary", style: .primary) {
|
|
// Primary button action
|
|
}
|
|
Button("Success", style: .success) {
|
|
// Success button action
|
|
}
|
|
Button("Destructive", style: .destructive) {
|
|
// Destructive button action
|
|
}
|
|
}
|
|
}
|
|
|
|
DemoSection("Disabled Button") {
|
|
HStack(spacing: 2) {
|
|
Button("Enabled") {}
|
|
Button("Disabled") {}.disabled()
|
|
}
|
|
}
|
|
|
|
DemoSection("Plain Style (No Border)") {
|
|
HStack(spacing: 2) {
|
|
Button("Link 1", style: .plain) {}
|
|
Button("Link 2", style: .plain) {}
|
|
}
|
|
}
|
|
|
|
DemoSection("ButtonRow (Horizontal Group)") {
|
|
ButtonRow(spacing: 3) {
|
|
Button("Cancel") {}
|
|
Button("Save", style: .primary) {}
|
|
}
|
|
}
|
|
|
|
DemoSection("Focus Navigation") {
|
|
VStack {
|
|
Text("Use [Tab] to move focus between buttons")
|
|
.dim()
|
|
Text("Use [Enter] or [Space] to press the focused button")
|
|
.dim()
|
|
}
|
|
}
|
|
|
|
Spacer()
|
|
}
|
|
}
|
|
}
|