<!--
{
  "availability" : [
    "iOS: 15.0.0 -",
    "iPadOS: 15.0.0 -",
    "macCatalyst: 15.0.0 -",
    "macOS: 12.0.0 -",
    "tvOS: 15.0.0 -",
    "visionOS: 1.0.0 -",
    "watchOS: 8.0.0 -"
  ],
  "documentType" : "symbol",
  "framework" : "SwiftUI",
  "identifier" : "/documentation/SwiftUI/View/monospacedDigit()",
  "metadataVersion" : "0.1.0",
  "role" : "Instance Method",
  "symbol" : {
    "kind" : "Instance Method",
    "modules" : [
      "SwiftUI"
    ],
    "preciseIdentifier" : "s:7SwiftUI4ViewPAAE15monospacedDigitQryF"
  },
  "title" : "monospacedDigit()"
}
-->

# monospacedDigit()

Modifies the fonts of all child views to use fixed-width digits, if
possible, while leaving other characters proportionally spaced.

```
nonisolated func monospacedDigit() -> some View
```

## Return Value

A view whose child views’ fonts use fixed-width numeric
characters, while leaving other characters proportionally spaced.

## Discussion

Using fixed-width digits allows you to easily align numbers of the
same size in a table-like arrangement. This feature is also known as
“tabular figures” or “tabular numbers.”

This modifier only affects numeric characters, and leaves all other
characters unchanged.

The following example shows the effect of `monospacedDigit()` on
multiple child views. The example consists of two [`VStack`](/documentation/SwiftUI/VStack) views
inside an [`HStack`](/documentation/SwiftUI/HStack). Each `VStack` contains two [`Button`](/documentation/SwiftUI/Button) views, with
the second `VStack` applying the `monospacedDigit()` modifier to its
contents. As a result, the digits in the buttons in the trailing
`VStack` are the same width, which in turn gives the buttons equal widths.

```
var body: some View {
    HStack(alignment: .top) {
        VStack(alignment: .leading) {
            Button("Delete 111 messages") {}
            Button("Delete 222 messages") {}
        }
        VStack(alignment: .leading) {
            Button("Delete 111 messages") {}
            Button("Delete 222 messages") {}
        }
        .monospacedDigit()
    }
    .padding()
    .navigationTitle("monospacedDigit() Child Views")
}
```

![A macOS window showing four buttons, arranged in two columns. Each](images/com.apple.SwiftUI/View-monospacedDigit-1@2x.png)

If a child view’s base font doesn’t support fixed-width digits, the font
remains unchanged.

---

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)