Modifiers
disabled
Disables or enables a view.
disabled(disabled)
| Parameter | Type | Description |
|---|---|---|
disabled(optional) | boolean | Whether the view should be disabled. Default: true |
Disables or enables a view.
Returns: ModifierConfig
See: Official SwiftUI documentation.
Works with
You can add disabled to any view. It changes what you see on 33 of the 39 components.
- VStack
- HStack
- ZStack
- LazyVStack
- LazyHStack
- Group
- Overlay
- ScrollView
- Button
- Toggle
- Checkbox
- Slider
- Picker
- DatePicker
- ColorPicker
- Link
- ControlGroup
- Menu
- ContextMenu
- TextField
- SecureField
- List
- Form
- Section
- DisclosureGroup
- SwipeActions
- BottomSheet
- Alert
- ConfirmationDialog
- Popover
- ProgressView
- Gauge
- TabView
No visible effect
These components accept it, but you see no change.
| Component | Why nothing happens |
|---|---|
| Spacer | It turns off the controls in the view, and Spacer has none. |
| Divider | It turns off the controls in the view, and Divider has none. |
| Text | It turns off the controls in the view, and Text has none. |
| Label | It turns off the controls in the view, and Label has none. |
| Image | It turns off the controls in the view, and Image has none. |
| AccessoryWidgetBackground | It turns off the controls in the view, and AccessoryWidgetBackground has none. |
Sources
The original Expo docs for this page:
- disabled (Modifiers) (
source-of-truth/versions/v57.0.0/sdk/ui/swift-ui/modifiers.md)