Button
Runs an action when pressed. Stepped corners, a one-dot shadow, and a one-dot press-down.
Variants and sizes
Web (React)
<DotwearButton onClick={save}>Save</DotwearButton>
<DotwearButton variant="secondary" size="small" onClick={cancel}>
Cancel
</DotwearButton>
<DotwearButton variant="danger" icon={dwTrash} onClick={remove}>
Delete
</DotwearButton>
iOS (SwiftUI)
Button("Save") { save() }
.buttonStyle(.dotwear)
Button("Cancel") { cancel() }
.buttonStyle(.dotwear(.secondary, size: .small))
Button(role: .destructive) { delete() } label: {
Label("Delete", systemImage: "trash")
}
.buttonStyle(.dotwear(.danger))
Loading
Web (React)
<DotwearButton icon={dwSave} loading={isSaving} disabled={isSaving} onClick={save}>
Save
</DotwearButton>
iOS (SwiftUI)
Button("Save") { save() }
.buttonStyle(.dotwear)
.dotwearLoading(isSaving)
.disabled(isSaving)
Variants
| Variant | Use for |
|---|---|
primary | The most important action on the screen (default) |
secondary | Any other action |
danger | Destructive actions such as delete |
ghost | Border only — for toolbars |
States
| State | Appearance |
|---|---|
| default | One-dot shadow below and to the right |
| pressed | Shadow removed, body shifts down by one dot |
| focused | One-dot focus ring outside the border |
| disabled | Disabled colors, no shadow |
| loading | Three animated dots replace the label |
React API
| Prop | Description |
|---|---|
variant="primary" | "primary" (default), "secondary", "danger", "ghost" |
size="medium" | "small", "medium" (default), "large" |
icon={dwSave} | An icon before the label (decorative). Icon-only buttons need aria-label |
loading | Shows the loading dots and sets aria-busy. Does not disable the button; add disabled if needed |
…button props | Any <button> attribute. type defaults to "button" |
SwiftUI API
| API | Description |
|---|---|
.buttonStyle(.dotwear) | Primary, medium |
.buttonStyle(.dotwear(_ variant:, size:)) | variant: .primary .secondary .danger .ghost — size: .small .medium .large |
.dotwearLoading(_ isLoading: Bool = true) | Shows the loading dots. Does not disable the button; add .disabled if needed |
Accessibility
- Web: it is a standard <button>, so keyboard, focus, screen readers and form submission work as usual. The focus ring appears for keyboard focus (:focus-visible).
- iOS: it is a standard Button, so VoiceOver, Dynamic Type, Full Keyboard Access and Voice Control work as usual.
- Icon-only buttons must have an accessibility label.