AccessibilityHeadingLevel

The hierarchy of a heading in relation to other headings.

EnumerationiOS 15.0+macOS 12.0+tvOS 15.0+watchOS 8.0+AccessibilityHeadingLevel in SwiftUI

Declaration

React
type AccessibilityHeadingLevel =
  | 'h1'
  | 'h2'
  | 'h3'
  | 'h4'
  | 'h5'
  | 'h6'
  | 'unspecified'
  | { rawValue: number; };
Swift
@frozen enum AccessibilityHeadingLevel

Pass a literal, or build one with SwiftUI.AccessibilityHeadingLevel from import { SwiftUI } from 'swiftui-react-native'.

Type properties

Type methods

Overview

Assistive technologies can use this to improve a user's navigation through multiple headings. When users navigate through top level headings they expect the content for each heading to be unrelated.

For example, you can categorize a list of available products into sections, like Fruits and Vegetables. With only top level headings, this list requires no heading hierarchy, and you use the unspecified heading level. On the other hand, if sections contain subsections, like if the Fruits section has subsections for varieties of Apples, Pears, and so on, you apply the h1 level to Fruits and Vegetables, and the h2 level to Apples and Pears.

Except for h1, be sure to precede all leveled headings by another heading with a level that's one less.

From Apple’s SwiftUI documentation. Code samples there are Swift.

Used by

See also

More in Accessibility.