Skip to main content
.disabled(isDisabled: boolean)
isDisabled
boolean
required
When true, the component and its descendants cannot receive interaction events. The component is also visually dimmed.

Support

Usage

Disable a button

Button("Submit", () => submit())
    .disabled(!isFormValid)

Disable an entire form section

VStack([
    TextField({ text, setText }),
    Button("Save", () => save())
])
    .disabled(isLoading)

Notes

disabled(true) both prevents interaction and applies a visual dimming effect. To prevent interaction without the visual change, use allowsHitTesting(false) instead.

See Also