Modifiers
underline
Applies an underline to the text.
underline(params)
| Parameter | Type | Description |
|---|---|---|
params | { color: Color, isActive: boolean, pattern: LinePattern } | Controls whether the underline is visible (true to show, false to hide). |
Applies an underline to the text.
Returns: ModifierConfig
See: Official SwiftUI documentation.
Works with
You can add underline to any view. It changes what you see on 34 of the 39 components.
- VStack
- HStack
- ZStack
- LazyVStack
- LazyHStack
- Group
- Overlay
- ScrollView
- Button
- Toggle
- Checkbox
- Picker
- DatePicker
- ColorPicker
- Link
- ControlGroup
- Menu
- ContextMenu
- TextField
- SecureField
- Label
- List
- Form
- Section
- DisclosureGroup
- SwipeActions
- BottomSheet
- Alert
- ConfirmationDialog
- Popover
- ProgressView
- Gauge
- TabView
Needs care
It works on these components, but not in the way that you may expect.
| Component | What to know |
|---|---|
| Text | A nested Text ignores this modifier. In debug builds, the nested text shows a red warning. |
No visible effect
These components accept it, but you see no change.
| Component | Why nothing happens |
|---|---|
| Spacer | It changes only text, and Spacer shows no text. |
| Divider | It changes only text, and Divider shows no text. |
| Slider | It changes only text, and Slider shows no text. |
| Image | It changes only text, and Image shows no text. |
| AccessoryWidgetBackground | It changes only text, and AccessoryWidgetBackground shows no text. |
Sources
The original Expo docs for this page:
- underline (Modifiers) (
source-of-truth/versions/v57.0.0/sdk/ui/swift-ui/modifiers.md)
truncationMode
Sets the truncation mode for lines of text that are too long to fit in the available space.
unredacted
Removes any redaction reason inherited from an ancestor redacted(...) for this subtree. The counterpart to redacted; use it to exempt specific content from a redacted parent. Maps to SwiftUI's unredacted().