DisclosureGroup
A SwiftUI DisclosureGroup component for displaying expandable content. Also called Collapsible (Universal).
Expo UI DisclosureGroup matches the official SwiftUI DisclosureGroup API and displays a disclosure indicator that reveals or hides content.
Usage
Basic disclosure group
DisclosureGroup is most commonly used inside a Form so it picks up the standard iOS list styling with a chevron indicator.
import { useState } from 'react';
import {
DisclosureGroup,
Form,
Host,
Section,
Text,
} from '@expo/ui/swift-ui';
export default function BasicDisclosureGroupExample() {
const [isExpanded, setIsExpanded] = useState(true);
return (
<Host style={{ flex: 1 }}>
<Form>
<Section>
<DisclosureGroup
label="Advanced settings"
isExpanded={isExpanded}
onIsExpandedChange={setIsExpanded}>
<Text>Auto-update apps</Text>
<Text>App downloads</Text>
<Text>Offload unused apps</Text>
</DisclosureGroup>
</Section>
</Form>
</Host>
);
}
Initially expanded
Set isExpanded to true initially to show the content by default.
import { useState } from 'react';
import { Host, DisclosureGroup, Text } from '@expo/ui/swift-ui';
export default function InitiallyExpandedExample() {
const [isExpanded, setIsExpanded] = useState(true);
// A disclosure group fills the width it is given, so `matchContents` collapses it.
return (
<Host style={{ flex: 1 }}>
<DisclosureGroup
label="Details"
isExpanded={isExpanded}
onIsExpandedChange={setIsExpanded}>
<Text>This content is visible by default.</Text>
</DisclosureGroup>
</Host>
);
}
Custom label
Use DisclosureGroup.Label when the label needs custom SwiftUI content or modifiers instead of the label string prop.
import { useState } from 'react';
import {
DisclosureGroup,
Form,
Host,
Section,
Text,
} from '@expo/ui/swift-ui';
import { font, foregroundStyle } from '@expo/ui/swift-ui/modifiers';
export default function CustomLabelDisclosureGroupExample() {
const [isExpanded, setIsExpanded] = useState(false);
return (
<Host style={{ flex: 1 }}>
<Form>
<Section>
<DisclosureGroup
isExpanded={isExpanded}
onIsExpandedChange={setIsExpanded}>
<DisclosureGroup.Label>
<Text
modifiers={[
font({ weight: 'semibold' }),
foregroundStyle('#0a7ea4'),
]}>
Network options
</Text>
</DisclosureGroup.Label>
<Text>Wi-Fi</Text>
<Text>Bluetooth</Text>
<Text>Cellular data</Text>
</DisclosureGroup>
</Section>
</Form>
</Host>
);
}
API
import { DisclosureGroup } from '@expo/ui/swift-ui';Component
DisclosureGroup
Type: React.Element<DisclosureGroupProps>
DisclosureGroupProps
children
Type: ReactNode
isExpanded
Optional • Type: boolean
Controls whether the disclosure group is expanded.
label
Optional • Type: string
Text label for the disclosure group. Use DisclosureGroup.Label for custom label content.
onIsExpandedChange
Optional • Type: (isExpanded: boolean) => void
A callback that is called when the expansion state changes.
Inherited props
Modifiers
Use these modifiers in the modifiers prop of the SwiftUI version.
The Universal version does not accept modifiers.
Expo UI lets you put any of the 89 modifiers for any view on DisclosureGroup, but not all of them do something here.
- 74 change what you see on DisclosureGroup.
- 2 have no visible effect on DisclosureGroup.
- 13 work only in one place, such as a widget or a
Grid.
Best modifiers for DisclosureGroup
These modifiers are the ones that you use most with DisclosureGroup.
Also works on DisclosureGroup
DisclosureGroup takes these modifiers too, and each one works in the usual way.
accessibilityAddTraitsaccessibilityElementaccessibilityHiddenaccessibilityHintaccessibilityIdentifieraccessibilityInputLabelsaccessibilityLabelaccessibilityRemoveTraitsaccessibilityValueallowsTighteninganimationaspectRatiobackgroundbackgroundOverlayblurboldborderbrightnessclippedclipShapecolorInvertcontainerRelativeFrameiOS 17+containerShapecontentShapecontentTransitioniOS 16+contrastcornerRadiusdynamicTypeSizeenvironmentfixedSizeforegroundColorframegeometryGroupiOS 17+glassEffectgrayscalehiddenhueRotationidignoreSafeAreaimageScaleitalickerninglineHeightiOS 26+lineLimitlineSpacingluminanceToAlphamaskminimumScaleFactormonospacedDigitmultilineTextAlignmentoffsetonAppearonDisappearonGeometryChangeonLongPressGestureonTapGestureopacityoverlayredactedrotation3DEffectrotationEffectsaturationscaleEffectshadowstrikethroughstrokeBordertextCasetruncationModeunderline
No visible effect on DisclosureGroup
DisclosureGroup accepts these modifiers, but you see no change. They do not give an error.
| Modifier | Why nothing happens |
|---|---|
layoutPriority | It has an effect only when the view shares an axis with other views in a stack. |
zIndex | It changes the order of views that cover each other in the same parent, and DisclosureGroup does not stack its children. |
Only in some places
These modifiers work only in a widget, in a Grid, in a Namespace or in a parent that asks for them.
| Modifier | Where it works |
|---|---|
activityBackgroundTint | Works only in a Live Activity. It has no effect in the app. |
alignmentGuide | Has an effect only when the parent, such as a VStack or ZStack, aligns its children by the same guide. |
containerBackground | Works only in a widget, or in a navigation container when you use a navigation placement. |
glassEffectId | Works only on a view that also has glassEffect, in a GlassEffectContainer and a Namespace. |
gridCellAnchor iOS 16+ | Works only on a cell of a Grid. Grid is in @expo/ui/swift-ui, but it has no Expo docs page. |
gridCellColumns | Works only on a view in a Grid.Row. Grid is in @expo/ui/swift-ui, but it has no Expo docs page. |
gridCellUnsizedAxes | Works only on a view in a Grid. Grid is in @expo/ui/swift-ui, but it has no Expo docs page. |
gridColumnAlignment iOS 16+ | Works only on a view in a Grid.Row. Grid is in @expo/ui/swift-ui, but it has no Expo docs page. |
invalidatableContent iOS 17+ | Has an effect only when a parent view uses redacted with the invalidated reason. |
matchedGeometryEffect | Works only in a Namespace. Give two views the same id and change between them with an animation. |
privacySensitive | Has an effect only when a parent view uses redacted with the privacy reason. |
unredacted | Has an effect only in a parent view that uses redacted. |
widgetURL | Works only in a widget. It has no effect in the app. |
Sources
The original Expo docs for this page:
- DisclosureGroup (SwiftUI) (
source-of-truth/versions/v57.0.0/sdk/ui/swift-ui/disclosuregroup.md) - DisclosureGroup (Universal) (
source-of-truth/versions/v57.0.0/sdk/ui/universal/collapsible.md)


