Expo UI and Router for iOSExpo SDK 57 and later, iOS only
Modifiers

Modifiers

All the SwiftUI modifiers, and the components that accept each one.

Usage

Modifiers are applied to components using the modifiers prop with an array syntax. You can combine multiple modifiers to create complex styling and behavior.

import { Text, Host, VStack } from '@expo/ui/swift-ui';
import {
  background,
  cornerRadius,
  padding,
  shadow,
  foregroundColor,
  onTapGesture,
} from '@expo/ui/swift-ui/modifiers';

function ModifiersExample() {
  const [isEnabled, setIsEnabled] = useState(false);

  return (
    <Host style={{ flex: 1 }}>
      <VStack spacing={20}>
        {/* Basic styling modifiers */}
        <Text
          modifiers={[
            background('#FF6B6B'),
            cornerRadius(12),
            padding({ all: 16 }),
            foregroundColor('#FFFFFF'),
          ]}>
          Basic styled text
        </Text>

        {/* Complex combination with shadow and interaction */}
        <Text
          modifiers={[
            background('#4ECDC4'),
            cornerRadius(16),
            padding({ horizontal: 20, vertical: 12 }),
            shadow({ radius: 4, x: 0, y: 2, color: '#4ECDC440' }),
            onTapGesture(() => console.log('Tapped!')),
          ]}>
          Styled with shadow and tap gesture
        </Text>

        {/* Conditional modifiers using spread operator */}
        <Text
          modifiers={[
            background('#9B59B6'),
            cornerRadius(8),
            padding({ all: 14 }),
            ...(isEnabled
              ? [shadow({ radius: 6, y: 3 }), scaleEffect(1.02)]
              : [grayscale(0.5), opacity(0.7)]),
          ]}>
          Conditional styling
        </Text>
      </VStack>
    </Host>
  );
}

You can also create custom modifiers that work with any Expo UI component. See the Extending with SwiftUI guide for details.

API

import { background, cornerRadius, padding, shadow, foregroundColor, onTapGesture } from '@expo/ui/swift-ui/modifiers';

All modifiers

ModifierMinimum iOSWorks with
accessibilityAddTraitsAny view
accessibilityElementAny view, but no effect on 19 of 39 components
accessibilityHiddenAny view
accessibilityHintAny view
accessibilityIdentifierAny view
accessibilityInputLabelsAny view
accessibilityLabelAny view
accessibilityRemoveTraitsAny view
accessibilityValueAny view
activityBackgroundTintAny view. Works only in a Live Activity. It has no effect in the app.
alignmentGuideAny view. Has an effect only when the parent, such as a VStack or ZStack, aligns its children by the same guide.
allowsTighteningAny view, but no effect on 5 of 39 components
animationAny view
aspectRatioAny view
autocorrectionDisabledTextField, SecureField
backgroundAny view, but no effect on 1 of 39 components
backgroundOverlayAny view, but no effect on 1 of 39 components
badgeList, TabView
badgeProminenceList
blurAny view, but no effect on 1 of 39 components
boldAny view, but no effect on 4 of 39 components
borderAny view, but no effect on 1 of 39 components
brightnessAny view, but no effect on 1 of 39 components
buttonBorderShapeButton
buttonStyleButton, Link
clippedAny view, but no effect on 1 of 39 components
clipShapeAny view, but no effect on 1 of 39 components
colorInvertAny view, but no effect on 1 of 39 components
containerBackgroundAny view. Works only in a widget, or in a navigation container when you use a navigation placement.
containerRelativeFrame17+Any view
containerShapeAny view, but no effect on 19 of 39 components
contentShapeAny view, but no effect on 5 of 39 components
contentTransition16+Any view, but no effect on 4 of 39 components
contrastAny view, but no effect on 1 of 39 components
controlSizeButton, Toggle, Checkbox, Slider, Picker, DatePicker, ColorPicker, Link, ControlGroup, Menu, TextField, SecureField, ProgressView, Gauge
cornerRadiusAny view, but no effect on 1 of 39 components
createModifierThis is not a modifier. It is a function that makes the config for a custom native modifier.
datePickerStyleDatePicker
defaultScrollAnchor17+ScrollView, List, Form
defaultScrollAnchorForRole18+ScrollView, List, Form
deleteDisabledList
disabledAny view, but no effect on 6 of 39 components
dynamicTypeSizeAny view, but no effect on 4 of 39 components
environmentAny view
fixedSizeAny view
fontAny view, but no effect on 4 of 39 components
foregroundColorAny view, but no effect on 2 of 39 components
foregroundStyleAny view, but no effect on 2 of 39 components
frameAny view
gaugeStyleGauge
geometryGroup17+Any view, but no effect on 19 of 39 components
glassEffectAny view, but no effect on 1 of 39 components
glassEffectIdAny view. Works only on a view that also has glassEffect, in a GlassEffectContainer and a Namespace.
grayscaleAny view, but no effect on 1 of 39 components
gridCellAnchor16+Any view. Works only on a cell of a Grid. Grid is in @expo/ui/swift-ui, but it has no Expo docs page.
gridCellColumnsAny view. Works only on a view in a Grid.Row. Grid is in @expo/ui/swift-ui, but it has no Expo docs page.
gridCellUnsizedAxesAny view. Works only on a view in a Grid. Grid is in @expo/ui/swift-ui, but it has no Expo docs page.
gridColumnAlignment16+Any view. Works only on a view in a Grid.Row. Grid is in @expo/ui/swift-ui, but it has no Expo docs page.
headerProminenceSection
hiddenAny view, but no effect on 1 of 39 components
hueRotationAny view, but no effect on 1 of 39 components
idAny view
ignoreSafeAreaAny view
imageScaleAny view, but no effect on 14 of 39 components
indexViewStyleTabView
interactiveDismissDisabledBottomSheet
invalidatableContent17+Any view. Has an effect only when a parent view uses redacted with the invalidated reason.
italicAny view, but no effect on 5 of 39 components
kerningAny view, but no effect on 5 of 39 components
keyboardTypeTextField, SecureField
labelsHiddenToggle, Checkbox, Slider, Picker, DatePicker, ColorPicker, ProgressView, Gauge
labelStyleButton, Menu, Label
layoutPriorityAny view, but no effect on 33 of 39 components
lineHeight26+Any view, but no effect on 5 of 39 components
lineLimitAny view, but no effect on 5 of 39 components
lineSpacingAny view, but no effect on 5 of 39 components
listRowBackgroundList, Form, Section
listRowInsetsList, Form, Section
listRowSeparatorList, Form, Section
listRowSeparatorTintList, Form, Section
listRowSpacing15+List, Form
listSectionMargins26+List, Form
listSectionSpacing17+List, Form
listStyleList
luminanceToAlphaAny view, but no effect on 1 of 39 components
maskAny view, but no effect on 1 of 39 components
matchedGeometryEffectAny view. Works only in a Namespace. Give two views the same id and change between them with an animation.
menuActionDismissBehavior16.4+Menu, ContextMenu
menuOrderMenu, ContextMenu
minimumScaleFactorAny view, but no effect on 5 of 39 components
monospacedDigitAny view, but no effect on 5 of 39 components
moveDisabledList
multilineTextAlignmentAny view, but no effect on 5 of 39 components
offsetAny view, but no effect on 1 of 39 components
onAppearAny view, but no effect on 6 of 39 components
onDisappearAny view, but no effect on 6 of 39 components
onGeometryChangeAny view, but no effect on 6 of 39 components
onLongPressGestureAny view, but no effect on 8 of 39 components
onScrollPhaseChange18+ScrollView, List, Form
onSubmitTextField, SecureField
onTapGestureAny view, but no effect on 12 of 39 components
opacityAny view, but no effect on 1 of 39 components
overlayAny view, but no effect on 1 of 39 components
paddingAny view
pickerStylePicker
presentationBackground16.4+BottomSheet, Popover
presentationBackgroundInteraction16.4+BottomSheet
presentationDetents16+BottomSheet, Popover
presentationDragIndicator16+BottomSheet, Popover
presentationSizing18+BottomSheet
privacySensitiveAny view. Has an effect only when a parent view uses redacted with the privacy reason.
progressViewStyleProgressView
redactedAny view, but no effect on 1 of 39 components
refreshableScrollView, List, Form
resizableImage
rotation3DEffectAny view, but no effect on 1 of 39 components
rotationEffectAny view, but no effect on 1 of 39 components
saturationAny view, but no effect on 1 of 39 components
scaleEffectAny view, but no effect on 1 of 39 components
scrollContentBackgroundList, Form
scrollDisabled16+ScrollView, List, Form
scrollDismissesKeyboard16+ScrollView, List, Form
scrollIndicators16+ScrollView, List, Form
scrollPosition17+ScrollView, List, Form
scrollTargetBehavior17+ScrollView, List, Form
scrollTargetLayout17+VStack, HStack, LazyVStack, LazyHStack
shadowAny view, but no effect on 1 of 39 components
strikethroughAny view, but no effect on 5 of 39 components
strokeBorderAny view, but no effect on 1 of 39 components
submitLabel15+TextField, SecureField
symbolEffect17+Label, Image
tabViewStyleTabView
tagPicker
textCaseAny view, but no effect on 5 of 39 components
textContentType13+TextField, SecureField
textFieldStyleTextField, SecureField
textInputAutocapitalization15+TextField, SecureField
textSelectionText
tintAny view, but no effect on 4 of 39 components
toggleStyleToggle, Checkbox
truncationModeAny view, but no effect on 5 of 39 components
underlineAny view, but no effect on 5 of 39 components
unredactedAny view. Has an effect only in a parent view that uses redacted.
widgetAccentedRenderingModeImage
widgetURLAny view. Works only in a widget. It has no effect in the app.
zIndexAny view, but no effect on 37 of 39 components

Sources

The original Expo docs for this page:

  • Modifiers (source-of-truth/versions/v57.0.0/sdk/ui/swift-ui/modifiers.md)

On this page