<!--
{
  "availability" : [
    "macOS: 10.11.0 -"
  ],
  "documentType" : "symbol",
  "framework" : "AppKit",
  "identifier" : "/documentation/AppKit/NSTextField/maximumNumberOfLines",
  "metadataVersion" : "0.1.0",
  "role" : "Instance Property",
  "symbol" : {
    "kind" : "Instance Property",
    "modules" : [
      "AppKit"
    ],
    "preciseIdentifier" : "c:objc(cs)NSTextField(py)maximumNumberOfLines"
  },
  "title" : "maximumNumberOfLines"
}
-->

# maximumNumberOfLines

The maximum number of lines a wrapping text field displays before clipping or truncating the text.

```
var maximumNumberOfLines: Int { get set }
```

## Discussion

The default value of `0` indicates no limit to the number of lines, and the text fills the bounds of the text field cell.

If the text field reaches the maximum number of lines, or if the height of the container can’t accommodate the number of lines, the text field clips or truncates the text, depending on the cell’s [`truncatesLastVisibleLine`](/documentation/AppKit/NSCell/truncatesLastVisibleLine) setting.

> Important:
> This value also affects ``doc://com.apple.appkit/documentation/AppKit/NSControl/sizeThatFits(_:)``, ``doc://com.apple.appkit/documentation/AppKit/NSView/fittingSize``, and ``doc://com.apple.appkit/documentation/AppKit/NSView/intrinsicContentSize``. If the value of this property isn’t `1`, the text field may use multiple lines to determine its intrinsic content size.

---

Copyright &copy; 2026 Apple Inc. All rights reserved. | [Terms of Use](https://www.apple.com/legal/internet-services/terms/site.html) | [Privacy Policy](https://www.apple.com/privacy/privacy-policy)