Sailfish OS
  • Info
  • User Experience
  • Cases
  • Community
  • Developers
  • Contact
  • Get Sailfish OS
Select Page
  • Info
  • User Experience
  • Cases
  • Community
  • Developers
  • Contact
  • Get Sailfish OS

API Documentation

Documentation for developing SailfishOS applications
  • API Documentation
  • Libsailfishapp
  • Sailfish Silica
    • Documentation
    • Icon Reference
  • Sailfish Components
    • Sailfish Accounts
    • Sailfish Bluetooth
    • Sailfish Contacts
    • Sailfish Crypto
    • Sailfish Gallery
    • Sailfish Media
    • Sailfish Pickers
    • Sailfish Secrets
    • Sailfish Share
    • Sailfish Telephony
    • Sailfish Webview
    • Amber Web Authorization
    • Amber MPRIS
  • Nemo QML Plugins
    • Configuration
    • Contacts
    • D-Bus
    • Keepalive
    • Notifications
    • Thumbnailer
  • Sailfish Middleware
    • MDM Framework
    • MDM Policy Framework
    • User Manager Daemon
  • API Documentation
  • Libsailfishapp
  • Sailfish Silica
    • Documentation
    • Icon Reference
  • Sailfish Components
    • Sailfish Accounts
    • Sailfish Bluetooth
    • Sailfish Contacts
    • Sailfish Crypto
    • Sailfish Gallery
    • Sailfish Media
    • Sailfish Pickers
    • Sailfish Secrets
    • Sailfish Share
    • Sailfish Telephony
    • Sailfish Webview
    • Amber Web Authorization
    • Amber MPRIS
  • Nemo QML Plugins
    • Configuration
    • Contacts
    • D-Bus
    • Keepalive
    • Notifications
    • Thumbnailer
  • Sailfish Middleware
    • MDM Framework
    • MDM Policy Framework
    • User Manager Daemon

Contents

  • Properties
  • Detailed Description
  • Default Text property values

Label QML Type

A text label More...

Import Statement: import Sailfish.Silica 1.0
Inherited By:

MenuItem and SectionHeader

  • List of all members, including inherited members

Properties

  • highlighted : bool
  • palette : Palette
  • truncationMode : enumeration

Detailed Description

The Label type provides a Sailfish-styled text label. The default color, font family and font size are set according to the current ambience.

The label text is simply set with the text property:

 import Sailfish.Silica 1.0

 Label {
     text: "Hello, world!"
 }

When choosing different colors or font properties it is recommended that the values exposed by the Theme object are used. For example:

 import Sailfish.Silica 1.0

 Label {
     text: "Hello, world!"
     color: Theme.highlightColor
     font.family: Theme.fontFamilyHeading
 }

See the Theme documentation for guidelines on styling text colors and sizes in Sailfish OS.

Label inherits the QtQuick Text type, so any properties, signals and methods of Text (such as the color and font.family properties in the example above) are also available to Label objects. See the Text documentation for its full list of available properties, signals and methods.

In most cases Label should be used in preference to the Text type.

Default Text property values

Labels use the following Text property values by default:

  • color: Theme.primaryColor
  • font.pixelSize: Theme.fontSizeMedium
  • textFormat: Text.PlainText
  • elide: if the text is truncated with TruncationMode.Elide, this elides automatically according to the current horizontalAlignment, otherwise this is Text.ElideNone

Property Documentation

highlighted : bool

Specifies whether an label should appear highlighted.

By default a label will be highlighted when a control it is a member of is highlighted.


palette : Palette

The label's color palette.

If one or more of a parent control's {SilicaControl::palette}{palette} colors have been overridden those changes will be reflected here. Otherwise the values will follow the equivalent Theme color properties.


truncationMode : enumeration

Specifies the effect to apply to the end of the text string if it does not fit within the bounds of this item. This is one of:

  • TruncationMode.None (default)
  • TruncationMode.Elide
  • TruncationMode.Fade

TruncationMode.Fade is the preferred truncation mode in Sailfish OS. Note it will only be applied to single line text; multiline text will fall back to TruncationMode.Elide.

Note that setting Text::elide will override truncationMode.


  • Legal
  • Contact Us
  • Jollyboys Ltd © 2024

  • Facebook
  • Twitter
  • Mastodon
  • YouTube
  • LinkedIn