Labels

A label is a static piece of text that people can read and often copy, but not edit.

Labels display text throughout the interface, in buttons, menu items, and views, helping people understand the current context and what they can do next.

The term label refers to uneditable text that can appear in various places. For example:

  • Within a button, a label generally conveys what the button does, such as Edit, Cancel, or Send.
  • Within many lists, a label can describe each item, often accompanied by a symbol or an image.
  • Within a view, a label might provide additional context by introducing a control or describing a common action or task that people can perform in the view.

DEVELOPER NOTE To display uneditable text, SwiftUI defines two components: Label and Text.

The guidance below can help you use a label to display text. In some cases, guidance for specific components — such as buttons, menus, and lists — includes additional recommendations for using text.

Best practices

Use a label to display a small amount of text that people don’t need to edit. If you need to let people edit a small amount of text, use a text field. If you need to display a large amount of text, and optionally let people edit it, use a text view.

Prefer system fonts. A label can display plain or styled text, and it supports Dynamic Type (where available) by default. If you adjust the style of a label or use custom fonts, make sure the text remains legible.

Use system-provided label colors to communicate relative importance. The system defines four label colors that vary in appearance to help you give text different levels of visual importance. For additional guidance, see Color.

System color Example usage iOS, iPadOS, tvOS macOS
Label Primary information labelColor labelColor
Secondary label A subheading or supplemental text secondaryLabelColor secondaryLabelColor
Tertiary label Text that describes an unavailable item or behavior tertiaryLabelColor tertiaryLabelColor
Quaternary label Watermark text quaternaryLabelColor quaternaryLabelColor

Make useful label text selectable. If a label contains useful information — like an error message, a location, or an IP address — consider letting people select and copy it for pasting elsewhere.

Platform considerations

No additional considerations for iOS, iPadOS, or tvOS.

macOS

DEVELOPER NOTE To display uneditable text in a label, use the isEditable property of NSTextField.

watchOS

In addition to using SwiftUI Label and Text components in your watchOS app, you can use WatchKit date and timer labels to display real-time values.

A date label (shown below on the left) displays the current date, the current time, or a combination of both. You can configure a date label to use a variety of formats, calendars, and time zones. After configuration, a date label updates its value without further input from your app. A timer label (shown below on the right) displays a precise countdown or count-up timer. You can configure a timer label to display its count value in a variety of formats. After configuration, a timer label counts down or up without further input from your app.

A screenshot of a Mail message, highlighted to show a date label that displays the date May fourth 2020 on the left and the time one PM on the right.

Date label

A screenshot of the Stopwatch app's Hybrid screen, highlighted to show the current time value of ten minutes and forty-four seconds.

Timer label

Consider using date and timer labels in complications. When you use the system-provided date and timer labels, watchOS automatically adjusts the presentation of the label content to fit the available space. For guidance, see Complications; for developer guidance, see CLKRelativeDateTextProvider.

Supported platforms