Modifiers
accessibilityElement
Controls how a view's child accessibility elements are exposed, mirroring SwiftUI's accessibilityElement(children:). It creates a new accessibility element (or modifies the existing one) and applies the chosen behavior to the subtree.
accessibilityElement(children)
| Parameter | Type | Description |
|---|---|---|
children(optional) | 'contain' | 'ignore' | 'combine' | How the child accessibility elements are treated |
ignore- hide the children; the new element starts with no properties, so pair it withaccessibilityLabel(default).combine- merge the children's accessibility properties into the new element.contain- keep the children as accessible elements, grouped in the new element as a container (navigated in order).
. Default: 'ignore' |
Controls how a view's child accessibility elements are exposed, mirroring SwiftUI's accessibilityElement(children:). It creates a new accessibility element (or modifies the existing one) and applies the chosen behavior to the subtree.
Complements accessibilityHidden, which hides a single leaf, by acting on the whole subtree.
Returns: ModifierConfig
See: Official SwiftUI documentation.
Works with
This modifier works with any view. These components accept it:
- VStack
- HStack
- ZStack
- LazyVStack
- LazyHStack
- Group
- Spacer
- Divider
- Overlay
- ScrollView
- Button
- Toggle
- Checkbox
- Slider
- Picker
- DatePicker
- ColorPicker
- Link
- ControlGroup
- Menu
- ContextMenu
- TextField
- SecureField
- Text
- Label
- Image
- List
- Form
- Section
- DisclosureGroup
- SwipeActions
- BottomSheet
- Alert
- ConfirmationDialog
- Popover
- ProgressView
- Gauge
- TabView
- AccessoryWidgetBackground
Sources
The original Expo docs for this page:
- accessibilityElement (Modifiers) (
source-of-truth/versions/v57.0.0/sdk/ui/swift-ui/modifiers.md)