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

VariantUse for
primaryThe most important action on the screen (default)
secondaryAny other action
dangerDestructive actions such as delete
ghostBorder only — for toolbars

States

StateAppearance
defaultOne-dot shadow below and to the right
pressedShadow removed, body shifts down by one dot
focusedOne-dot focus ring outside the border
disabledDisabled colors, no shadow
loadingThree animated dots replace the label

React API

PropDescription
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
loadingShows the loading dots and sets aria-busy. Does not disable the button; add disabled if needed
…button propsAny <button> attribute. type defaults to "button"

SwiftUI API

APIDescription
.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.