accessibilityLabeledPair

Pairs an accessibility element representing a label with the element for the matching content.

View ModifieriOS 14.0+macOS 11.0+tvOS 14.0+watchOS 7.0+accessibilityLabeledPair(role:id:in:) in SwiftUI

Declaration

React
compose().accessibilityLabeledPair<ID>({
  role: SwiftUI.AccessibilityLabeledPairRole,
  id: ID,
  in: string,
})
Swift
nonisolated func accessibilityLabeledPair<ID>(
    role: AccessibilityLabeledPairRole,
    id: ID,
    in namespace: Namespace.ID
) -> some View
where ID : Hashable

Parameters

  • Determines whether this element should be used as the label in the pair, or the content in the pair.

  • options.id*ID

    The identifier for the label / content pair. Elements with matching identifiers within the same namespace will be paired together.

  • options.in*string

Discussion

Use accessibilityLabeledPair with a role of AccessibilityLabeledPairRole.label to identify the label, and a role of AccessibilityLabeledPairRole.content to identify the content. This improves the behavior of accessibility features such as VoiceOver when navigating such elements, allowing users to better understand the relationship between them.

See also

More in Accessibility.