Skip to content

Add Button support #1024

Description

@Kyle-Ye

Summary

Complete public Button support so buttons render their labels and invoke their actions through supported input mechanisms.

Scope

  • Complete the generic Button implementation and its common label, title, and role initializers.
  • Connect pointer or touch activation to the button action, including disabled-state handling.
  • Integrate ButtonStyle, PrimitiveButtonStyle, their configuration values, .buttonStyle(_:), and baseline default, plain, and borderless styles.
  • Propagate label, role, enabled, and pressed state through the style pipeline.
  • Add examples and focused coverage for rendering, activation, disabled buttons, roles, and custom styles.

Acceptance criteria

  • Button("Run") { ... } renders its label and invokes its action once per activation.
  • A disabled button does not invoke its action.
  • Custom button styles receive the expected label, role, and pressed state.
  • Primitive button styles can trigger the configured action.
  • Button activation participates in the supported host's normal focus and accessibility behavior.

API reference

Metadata

Metadata

Assignees

No one assigned

    Labels

    area: event-gestureEvents, gestures, tracing, or interaction plumbing.area: viewView APIs, modifiers, AnyView, ForEach, DynamicView, and related behavior.type: featureNew API, behavior, platform support, or user-facing capability.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions