actions/DSButtonGroup
DSButtonGroup
actionsHorizontal pair of buttons for common action patterns like Cancel + Confirm.
iOSmacOS
Purpose
Use for dialogs, forms, or any UI requiring paired actions. Automatically handles spacing and layout.
Props
| Prop | Type | Default | Description |
|---|---|---|---|
| primaryLabelreq | String | — | Primary button text |
| primaryVariant | DSButtonVariant | .primary | Primary button style |
| primaryActionreq | (() -> Void) | — | Primary button action |
| secondaryLabelreq | String | — | Secondary button text |
| secondaryVariant | DSButtonVariant | .ghost | Secondary button style |
| secondaryActionreq | (() -> Void) | — | Secondary button action |
| spacing | CGFloat | DSSpacing.sm | Space between buttons |
Examples
Dialog actions
Cancel and confirm buttons for a dialog.
swift
DSButtonGroup(
primaryLabel: "Delete",
primaryVariant: .destructive,
primaryAction: { deleteItem() },
secondaryLabel: "Cancel",
secondaryAction: { dismiss() }
)Form actions
Save and cancel for a form.
swift
DSButtonGroup(
primaryLabel: "Save",
primaryVariant: .primary,
primaryAction: { saveForm() },
secondaryLabel: "Cancel",
secondaryVariant: .ghost,
secondaryAction: { cancelEdit() }
)Usage Guidelines
- Place primary action on the right (trailing position)
- Use destructive variant for dangerous primary actions
- Keep button labels short and action-oriented
- Secondary button typically uses ghost or secondary variant