Expo UI and Router for iOS
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
accessibilityHiddenAny view
accessibilityHintAny view
accessibilityIdentifierAny view
accessibilityInputLabelsAny view
accessibilityLabelAny view
accessibilityRemoveTraitsAny view
accessibilityValueAny view
activityBackgroundTintAny view
alignmentGuideAny view
allowsTighteningAny view
animationAny view
aspectRatioAny view
autocorrectionDisabledTextField, SecureField
backgroundAny view
backgroundOverlayAny view
badgeList, TabView
badgeProminenceList
blurAny view
boldAny view
borderAny view
brightnessAny view
buttonBorderShapeButton
buttonStyleButton, Link
clippedAny view
clipShapeAny view
colorInvertAny view
containerBackgroundAny view
containerRelativeFrame17+Any view
containerShapeAny view
contentShapeAny view
contentTransition16+Any view
contrastAny view
controlSizeButton, Toggle, Checkbox, Slider, Picker, DatePicker, ColorPicker, Link, ControlGroup, Menu, TextField, SecureField, ProgressView, Gauge
cornerRadiusAny view
createModifierAny view
datePickerStyleDatePicker
defaultScrollAnchor17+ScrollView, List, Form
defaultScrollAnchorForRole18+ScrollView, List, Form
deleteDisabledList
disabledAny view
dynamicTypeSizeAny view
environmentAny view
fixedSizeAny view
fontAny view
foregroundColorAny view
foregroundStyleAny view
frameAny view
gaugeStyleGauge
geometryGroup17+Any view
glassEffectAny view
glassEffectIdAny view
grayscaleAny view
gridCellAnchor16+Any view
gridCellColumnsAny view
gridCellUnsizedAxesAny view
gridColumnAlignment16+Any view
headerProminenceSection
hiddenAny view
hueRotationAny view
idAny view
ignoreSafeAreaAny view
imageScaleAny view
indexViewStyleTabView
interactiveDismissDisabledBottomSheet
invalidatableContent17+Any view
italicAny view
kerningAny view
keyboardTypeTextField, SecureField
labelsHiddenToggle, Checkbox, Slider, Picker, DatePicker, ColorPicker, ProgressView, Gauge
labelStyleButton, Menu, Label
layoutPriorityAny view
lineHeight26+Any view
lineLimitAny view
lineSpacingAny view
listRowBackgroundList, Form, Section
listRowInsetsList, Form, Section
listRowSeparatorList, Form, Section
listRowSeparatorTintList, Form, Section
listRowSpacing15+List, Form
listSectionMargins26+List, Form
listSectionSpacing17+List, Form
listStyleList
luminanceToAlphaAny view
maskAny view
matchedGeometryEffectAny view
menuActionDismissBehavior16.4+Menu, ContextMenu
menuOrderMenu, ContextMenu
minimumScaleFactorAny view
monospacedDigitAny view
moveDisabledList
multilineTextAlignmentAny view
offsetAny view
onAppearAny view
onDisappearAny view
onGeometryChangeAny view
onLongPressGestureAny view
onScrollPhaseChange18+ScrollView, List, Form
onSubmitTextField, SecureField
onTapGestureAny view
opacityAny view
overlayAny view
paddingAny view
pickerStylePicker
presentationBackground16.4+BottomSheet, Popover
presentationBackgroundInteraction16.4+BottomSheet
presentationDetents16+BottomSheet, Popover
presentationDragIndicator16+BottomSheet, Popover
presentationSizing18+BottomSheet
privacySensitiveAny view
progressViewStyleProgressView
redactedAny view
refreshableScrollView, List, Form
resizableImage
rotation3DEffectAny view
rotationEffectAny view
saturationAny view
scaleEffectAny view
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
strikethroughAny view
strokeBorderAny view
submitLabel15+TextField, SecureField
symbolEffect17+Label, Image
tabViewStyleTabView
tagPicker, TabView
textCaseAny view
textContentType13+TextField, SecureField
textFieldStyleTextField, SecureField
textInputAutocapitalization15+TextField, SecureField
textSelectionText
tintAny view
toggleStyleToggle, Checkbox
truncationModeAny view
underlineAny view
unredactedAny view
widgetAccentedRenderingModeImage
widgetURLAny view
zIndexAny view

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