Components

From moasq/nanowave · View interactive version

Components is an AI agent skill from the GitHub repository moasq/nanowave. SwiftUI component patterns: buttons, cards, lists, sheets, alerts. Use when implementing UI patterns related to components.

How to use this skill

Skill file

Component Patterns

BUTTON HIERARCHY (one primary per screen/section):

| Level | Style | Use Case | Code |

|------------|----------------------|-----------------------------------|----------------------------------------------------|

| Primary | .borderedProminent | Main action (Save, Submit, Start) | .buttonStyle(.borderedProminent).controlSize(.large)|

| Secondary | .bordered | Alternative action (Cancel, Edit) | .buttonStyle(.bordered) |

| Tertiary | .borderless | Low-emphasis (Skip, Learn More) | .buttonStyle(.borderless) |

| Destructive| .borderedProminent | Delete, Remove | .buttonStyle(.borderedProminent).tint(.red) |

CARD DESIGN PATTERN:

VStack(alignment: .leading, spacing: AppTheme.Spacing.xSmall) {
    HStack {
        Image(systemName: "icon.name")
            .font(.title3)
            .foregroundStyle(AppTheme.Colors.primary)
        Spacer()
        Text("metadata")
            .font(.caption)
            .foregroundStyle(.secondary)
    }
    Text("Title")
        .font(.headline)
    Text("Description text goes here")
        .font(.subheadline)
        .foregroundStyle(.secondary)
}
.padding(AppTheme.Spacing.medium)
.background(AppTheme.Colors.surface)
.clipShape(RoundedRectangle(cornerRadius: AppTheme.Style.cornerRadius))
.shadow(color: .black.opacity(0.06), radius: 8, y: 4)

INPUT FIELD STATES:

TextField("Email", text: $email)
    .textFieldStyle(.roundedBorder)
    .overlay(
        RoundedRectangle(cornerRadius: 8)
            .stroke(emailError != nil ? .red : .clear, lineWidth: 1)
    )
if let error = emailError {
    Text(error)
        .font(.caption)
        .foregroundStyle(.red)
}

LOADING STATES:

| Pattern | Use Case | Code |

|-------------------|-----------------------------------|-----------------------------------------|

| Inline spinner | Button action, single item | ProgressView().controlSize(.small) |

| Full-screen | Initial data load | ProgressView("Loading...") |

| Pull-to-refresh | List refresh | .refreshable { await refresh() } |

| Skeleton | Content placeholder | .redacted(reason: .placeholder) |

| Overlay | Blocking operation | .overlay { if loading { ProgressView() } } |

BADGE/CHIP PATTERN:

Text("Label")
    .font(.caption)
    .fontWeight(.medium)
    .padding(.horizontal, 8)
    .padding(.vertical, 4)
    .background(AppTheme.Colors.primary.opacity(0.15))
    .foregroundStyle(AppTheme.Colors.primary)
    .clipShape(Capsule())

TOGGLE/SWITCH:

PICKER PATTERNS:

EMPTY STATES:

DIVIDERS:

Use this skill with your AI agent: Open on Skill Issue to copy, download, or add to your library. Works with Claude, ChatGPT, Gemini, Cursor, Windsurf and more.