---
title: "Text Tightening | Explore SwiftUI"
description: "Sets whether text in this view can compress the space between characters when necessary to fit text in a line"
canonical_url: "https://exploreswiftui.com/library/view/text-tightening"
meta:
  author: "Explore SwiftUI"
  "og:description": "Sets whether text in this view can compress the space between characters when necessary to fit text in a line"
  "og:image": "https://exploreswiftui.com/_og/d/c_Component%2Ctitle_Text%2BTightening%2Cdescription_Sets%2Bwhether%2Btext%2Bin%2Bthis%2Bview%2Bcan%2Bcompress%2Bthe%2Bspace%2Bbetween%2Bcharacters%2Bwhen%2Bnecessary%2Bto%2Bfit%2Btext%2Bin%2Ba%2Bline.%2Ccategory_View%2Cimage_~L2FwaS9pbWFnZXMvMjc1L3ZhcmlhbnRzLzMzMDg~dj0xNzk2MzEyNjI4MDU1JnI9MiZ3PTEyODAmcT04NSZmPWpwZWc%2CimageMode_crop%2CimagePosition_center%2CimageFrame_~cG9zaXRpb246IGFic29sdXRlOyByaWdodDogMDsgd2lkdGg6IDY0MHB4OyBoZWlnaHQ6IDQ4MHB4OyBkaXNwbGF5OiBmbGV4OyBvdmVyZmxvdzogaGlkZGVuOyBiYWNrZ3JvdW5kOiAjRkZGRkZGOyBib3gtc2hhZG93OiAwIC0xMHB4IDUwcHggcmdiYSgzNyw5OSwyMzUsMC4xOCk7IGJvcmRlci1sZWZ0OiAxcHggc29saWQgcmdiYSgwLDAsMCwwLjA2KTsgdG9wOiA3NXB4OyBib3JkZXItdG9wOiAxcHggc29saWQgcmdiYSgwLDAsMCwwLjA2KTsgYm9yZGVyLWJvdHRvbTogMXB4IHNvbGlkIHJnYmEoMCwwLDAsMC4wNik7IGJvcmRlci10b3AtbGVmdC1yYWRpdXM6IDMycHg7IGJvcmRlci1ib3R0b20tbGVmdC1yYWRpdXM6IDMycHg7%2Cprops_eyJwbGF0Zm9ybXMiOlsiaU9TIiwiaVBhZE9TIiwibWFjT1MiLCJ3YXRjaE9TIiwidHZPUyIsInZpc2lvbk9TIl19%2Cp_Ii9saWJyYXJ5L3ZpZXcvdGV4dC10aWdodGVuaW5nIg%2Cs_uAthc5_Z5WU71jib.png"
  "og:image:height": "630"
  "og:image:type": image/png
  "og:image:width": "1200"
  "og:title": "Text Tightening | Explore SwiftUI"
  "twitter:description": "Sets whether text in this view can compress the space between characters when necessary to fit text in a line"
  "twitter:image": "https://exploreswiftui.com/_og/d/c_Component%2Ctitle_Text%2BTightening%2Cdescription_Sets%2Bwhether%2Btext%2Bin%2Bthis%2Bview%2Bcan%2Bcompress%2Bthe%2Bspace%2Bbetween%2Bcharacters%2Bwhen%2Bnecessary%2Bto%2Bfit%2Btext%2Bin%2Ba%2Bline.%2Ccategory_View%2Cimage_~L2FwaS9pbWFnZXMvMjc1L3ZhcmlhbnRzLzMzMDg~dj0xNzk2MzEyNjI4MDU1JnI9MiZ3PTEyODAmcT04NSZmPWpwZWc%2CimageMode_crop%2CimagePosition_center%2CimageFrame_~cG9zaXRpb246IGFic29sdXRlOyByaWdodDogMDsgd2lkdGg6IDY0MHB4OyBoZWlnaHQ6IDQ4MHB4OyBkaXNwbGF5OiBmbGV4OyBvdmVyZmxvdzogaGlkZGVuOyBiYWNrZ3JvdW5kOiAjRkZGRkZGOyBib3gtc2hhZG93OiAwIC0xMHB4IDUwcHggcmdiYSgzNyw5OSwyMzUsMC4xOCk7IGJvcmRlci1sZWZ0OiAxcHggc29saWQgcmdiYSgwLDAsMCwwLjA2KTsgdG9wOiA3NXB4OyBib3JkZXItdG9wOiAxcHggc29saWQgcmdiYSgwLDAsMCwwLjA2KTsgYm9yZGVyLWJvdHRvbTogMXB4IHNvbGlkIHJnYmEoMCwwLDAsMC4wNik7IGJvcmRlci10b3AtbGVmdC1yYWRpdXM6IDMycHg7IGJvcmRlci1ib3R0b20tbGVmdC1yYWRpdXM6IDMycHg7%2Cprops_eyJwbGF0Zm9ybXMiOlsiaU9TIiwiaVBhZE9TIiwibWFjT1MiLCJ3YXRjaE9TIiwidHZPUyIsInZpc2lvbk9TIl19%2Cp_Ii9saWJyYXJ5L3ZpZXcvdGV4dC10aWdodGVuaW5nIg%2Cs_uAthc5_Z5WU71jib.png"
  "twitter:title": "Text Tightening | Explore SwiftUI"
---

> Index of every page on this site: [llms.txt](https://exploreswiftui.com/llms.txt)

**Interactive previews**[iPhone](https://exploreswiftui.com/iphone?element=275)

# **Text Tightening**

Sets whether text in this view can compress the space between characters when necessary to fit text in a line.

![Text Tightening - iOS on iPhone - Portrait - Liquid Glass - Light Mode - Preview](https://exploreswiftui.com/api/images/275/variants/3308?v=1796312628055&r=2&w=800&q=80&f=webp)

### **Platform Compatibility**

iOS 13.0+ iPadOS 13.0+ macOS 10.15+ watchOS 6.0+ tvOS 13.0+ visionOS 1.0+

### **Tags**

### **SwiftUI Code**

[Docs](<https://developer.apple.com/documentation/swiftui/view/allowstightening(_:)>)

```
VStack {
    Text("FooBar FooBar")
        .lineLimit(1)
        .allowsTightening(true)
        .frame(width: width, alignment: .leading)
        .background(.red)

    Text("FooBar FooBar")
        .lineLimit(1)
        .allowsTightening(false)
        .frame(width: width, alignment: .leading)
        .background(.red)
}
```

### **Found an issue or have a suggestion?**

Created: December 3, 2026Updated: December 3, 2026

### **More View Components **

[**View all **](https://exploreswiftui.com/library/view)

![Scroll Gesture Axis Lock - iOS on iPhone - Portrait - Liquid Glass - Light Mode - Preview](https://exploreswiftui.com/api/images/262/variants/2227?v=1794899667529&r=2&w=412&q=75&f=webp)

### **Scroll Gesture Axis Lock**

Sets whether scrollable views within this view lock each scroll gesture to its predominant axis. On macOS, scroll gestures lock to their predominant axis by default. On iOS, iPadOS, Mac Catalyst, visionOS, and watchOS, scroll gestures move along both axes at once.

![VisionOS background materials - visionOS - Liquid Glass - Light Mode - Preview](https://exploreswiftui.com/api/images/260/variants/2143?v=1793707679045&r=2&w=412&q=75&f=webp)

### **VisionOS background materials**

All background materials on visionOS

![Container Content Margins - iOS on iPhone - Portrait - Liquid Glass - Light Mode - Preview](https://exploreswiftui.com/api/images/257/variants/1987?v=1792070676534&r=2&w=412&q=75&f=webp)

### **Container Content Margins**

Adds the margins of the container the view is in.

![Toolbar Vertical Edge - iOS on iPhone - Portrait - Liquid Glass - Light Mode - Preview](https://exploreswiftui.com/api/images/254/variants/1863?v=1790589836833&r=2&w=412&q=75&f=webp)

### **Toolbar Vertical Edge**

This value reflects the system’s preferred edge for the vertical bar in the current context, regardless of whether a vertical bar is currently visible. Use it to position custom bars or other UI relative to the system’s bar placement.

![Hinge State - iOS on iPhone Duo - Landscape - Fully Open - Liquid Glass - Light Mode - Preview](https://exploreswiftui.com/api/images/249/variants/1765?v=1793099575627&r=2&w=412&q=75&f=webp)

### **Hinge State**

A type encapsulating the state of a single hinge.

![Disabled Toolbar Vertical Behavior - iOS on iPhone Duo - Landscape - Fully Open - Liquid Glass - Light Mode - Preview](https://exploreswiftui.com/api/images/246/variants/1636?v=1790277107518&r=2&w=412&q=75&f=webp)

### **Disabled Toolbar Vertical Behavior**

Disables the vertical bar.

![Music Picker - iOS on iPhone - Portrait - Liquid Glass - Light Mode - Preview](https://exploreswiftui.com/api/images/232/variants/727?v=1790073478842&r=2&w=412&q=75&f=webp)

### **Music Picker**

Presents a music picker to select items from the Apple Music catalog and the user’s music library.

![App Store Overlay - iOS on iPhone - Portrait - Liquid Glass - Light Mode - Preview](https://exploreswiftui.com/api/images/224/variants/269?v=1790073478842&r=2&w=412&q=75&f=webp)

### **App Store Overlay**

Presents a StoreKit overlay when a given condition is true.

### **Explore Other Components **

[**Browse all **](https://exploreswiftui.com/)

![Outline Group - iOS on iPhone - Portrait - Flat Design - Light Mode - Preview](https://exploreswiftui.com/api/images/132/variants/371?v=1790073478842&r=2&w=412&q=75&f=webp)

### **Outline Group**

A structure that computes views and disclosure groups on demand from an underlying collection of tree-structured, identified data.

![ProgressView Colors - iOS on iPhone - Portrait - Liquid Glass - Light Mode - Preview](https://exploreswiftui.com/api/images/81/variants/24?v=1790073478842&r=2&w=412&q=75&f=webp)

### **ProgressView Colors**

Customizing the colors of the ProgressView

![LinearCapacityGaugeStyle - iOS on iPhone - Portrait - Liquid Glass - Light Mode - Preview](https://exploreswiftui.com/api/images/43/variants/267?v=1790073478842&r=2&w=412&q=75&f=webp)

### **LinearCapacityGaugeStyle**

A gauge style that displays a bar that fills from leading to trailing edges as the gauge’s current value increases

![Content Unavailable Search Text - iOS on iPhone - Portrait - Liquid Glass - Light Mode - Preview](https://exploreswiftui.com/api/images/3/variants/10?v=1790073478842&r=2&w=412&q=75&f=webp)

### **Content Unavailable Search Text**

A pre-built placeholder for empty search results with search text

![Delete Disabled - iOS on iPhone - Portrait - Flat Design - Light Mode - Preview](https://exploreswiftui.com/api/images/127/variants/351?v=1790073478842&r=2&w=412&q=75&f=webp)

### **Delete Disabled**

Adds a condition for whether the view’s view hierarchy is deletable.

![List Section Separator Tint - iOS on iPhone - Portrait - Flat Design - Light Mode - Preview](https://exploreswiftui.com/api/images/118/variants/287?v=1790073478842&r=2&w=412&q=75&f=webp)

### **List Section Separator Tint**

Sets the tint color associated with a section.

![Disclosure Group - iOS on iPhone - Portrait - Flat Design - Light Mode - Preview](https://exploreswiftui.com/api/images/131/variants/363?v=1790073478842&r=2&w=412&q=75&f=webp)

### **Disclosure Group**

A view that shows or hides another content view, based on the state of a disclosure control.

![Vertical Divider - iOS on iPhone - Portrait - Liquid Glass - Light Mode - Preview](https://exploreswiftui.com/api/images/70/variants/61?v=1790073478842&r=2&w=412&q=75&f=webp)

### **Vertical Divider**

A vertical visual element that can be used to separate other content

```json
{"@context":"https://schema.org","@graph":[{"@id":"https://exploreswiftui.com/#website","@type":"WebSite","description":"A visual library for SwiftUI APIs, components, and modifiers","inLanguage":"en-US","name":"Explore SwiftUI","url":"https://exploreswiftui.com/","publisher":{"@id":"https://exploreswiftui.com/#identity"}},{"@id":"https://exploreswiftui.com/library/view/text-tightening#webpage","@type":"WebPage","dateModified":"2026-12-03T15:43:48.061Z","datePublished":"2026-12-03T15:39:00.000Z","description":"Sets whether text in this view can compress the space between characters when necessary to fit text in a line","name":"Text Tightening","url":"https://exploreswiftui.com/library/view/text-tightening","breadcrumb":{"@id":"https://exploreswiftui.com/library/view/text-tightening#breadcrumb"},"isPartOf":{"@id":"https://exploreswiftui.com/#website"},"mainEntity":{"@id":"https://exploreswiftui.com/library/view/text-tightening#article"},"potentialAction":[{"@type":"ReadAction","target":["https://exploreswiftui.com/library/view/text-tightening"]}],"primaryImageOfPage":{"@id":"https://exploreswiftui.com/#logo"}},{"@id":"https://exploreswiftui.com/#identity","@type":"Organization","description":"A visual library for SwiftUI APIs, components, and modifiers","name":"Explore SwiftUI","url":"https://exploreswiftui.com","logo":{"@id":"https://exploreswiftui.com/#logo"},"sameAs":["https://x.com/Typ0genius","https://mastodon.social/@Typ0genius"]},{"@id":"https://exploreswiftui.com/library/view/text-tightening#article","citation":"https://developer.apple.com/documentation/swiftui/view/allowstightening(_:)","dateModified":"2026-12-03T15:43:48.061Z","datePublished":"2026-12-03T15:39:00.000Z","description":"Sets whether text in this view can compress the space between characters when necessary to fit text in a line","headline":"Text Tightening","inLanguage":"en-US","name":"Text Tightening","thumbnailUrl":"https://exploreswiftui.com/api/images/275/variants/3308?v=1796312628055&r=2","url":"https://exploreswiftui.com/library/view/text-tightening","@type":["Article","TechArticle"],"about":{"@type":"Thing","name":"SwiftUI"},"author":{"@id":"https://exploreswiftui.com/#identity"},"hasPart":{"@id":"https://exploreswiftui.com/library/view/text-tightening#source-code"},"image":{"@id":"https://exploreswiftui.com/library/view/text-tightening#/schema/image/1"},"isPartOf":{"@id":"https://exploreswiftui.com/library/view/text-tightening#webpage"},"mainEntityOfPage":{"@id":"https://exploreswiftui.com/library/view/text-tightening#webpage"},"publisher":{"@id":"https://exploreswiftui.com/#identity"}},{"@id":"https://exploreswiftui.com/library/view/text-tightening#source-code","@type":"SoftwareSourceCode","codeSampleType":"full example","description":"Sets whether text in this view can compress the space between characters when necessary to fit text in a line","name":"Text Tightening SwiftUI Example","programmingLanguage":"Swift","runtimePlatform":"SwiftUI","text":"VStack {\n    Text(\"FooBar FooBar\")\n        .lineLimit(1)\n        .allowsTightening(true)\n        .frame(width: width, alignment: .leading)\n        .background(.red)\n\n    Text(\"FooBar FooBar\")\n        .lineLimit(1)\n        .allowsTightening(false)\n        .frame(width: width, alignment: .leading)\n        .background(.red)\n}","about":[{"@type":"Thing","name":"SwiftUI"},{"@type":"Thing","name":"View"},{"@type":"Thing","name":"Text Tightening"}]},{"@id":"https://exploreswiftui.com/library/view/text-tightening#breadcrumb","@type":"BreadcrumbList","itemListElement":[{"@type":"ListItem","name":"Home","item":"https://exploreswiftui.com","position":1},{"@type":"ListItem","name":"View","item":"https://exploreswiftui.com/library/view","position":2},{"@type":"ListItem","name":"Text Tightening","item":"https://exploreswiftui.com/library/view/text-tightening","position":3}]},{"@id":"https://exploreswiftui.com/#logo","@type":"ImageObject","caption":"Explore SwiftUI","contentUrl":"https://exploreswiftui.com/apple-touch-icon.png","inLanguage":"en","url":"https://exploreswiftui.com/apple-touch-icon.png"},{"@id":"https://exploreswiftui.com/library/view/text-tightening#/schema/image/1","@type":"ImageObject","contentUrl":"https://exploreswiftui.com/api/images/275/variants/3308?v=1796312628055&r=2","inLanguage":"en","url":"https://exploreswiftui.com/api/images/275/variants/3308?v=1796312628055&r=2"}]}
```