React NativeScript

React NativeScript

  • Docs

›ELEMENTS: COMPONENTS

INTRODUCTION

  • Introduction

GETTING STARTED

  • Quick Start
  • Environment Setup
  • Using React Devtools

CORE CONCEPTS

  • Native Access
  • Navigation
  • Node Roles
  • Modals
  • Plugins
  • Styling

SAMPLES

  • Apps

ELEMENTS: LAYOUT

  • AbsoluteLayout
  • DockLayout
  • FlexboxLayout
  • GridLayout
  • StackLayout
  • WrapLayout

ELEMENTS: COMPONENTS

  • ActivityIndicator
  • ActionBar
  • ActionItem
  • Button
  • DatePicker
  • Frame
  • HtmlView
  • Image
  • Label
  • ListView
  • ListPicker
  • NavigationButton
  • Page
  • Placeholder
  • Progress
  • ScrollView
  • SearchBar
  • SegmentedBar
  • Slider
  • Switch
  • TabView
  • TabViewItem
  • TextField
  • TextView
  • TimePicker
  • WebView

LICENCES

  • Licences
Edit

Label

<label> is a UI component that displays read-only text.

IMPORTANT: This <label> is not the same as the HTML <label>.

See also:

  • Official top-level documentation
  • Detailed API specification

You can either use the <label> element's text prop or enter text as a child node.

import * as React from "react";

<label>This is a Label</label>

Styling the label

If you need to style parts of the text, you can use a combination of a FormattedString and Span elements.

You can either use the <span> element's text prop or enter text as a child node.

import * as React from "react";
import { Color } from "@nativescript/core";

<label textWrap={true}>
  <formattedString>
    <span>This text has a </span>
    <span color={new Color("red")}>red </span>
    <span>piece of text. </span>
    <span fontStyle="italic">Also, this bit is italic, </span>
    <span fontWeight="bold">and this bit is bold.</span>
  </formattedString>
</label>

Props

NameTypeDescription
textstringGets or sets the text of the label.
textWrapbooleanGets or sets whether the label wraps text.
Default value: false.

Native component

AndroidiOS
android.widget.TextViewUILabel
Last updated by Jamie Birch
← ImageListView →
  • Props
  • Native component
React NativeScript
Docs
Getting StartedUI Components Reference
Community
Stack OverflowChat on Slack in #reactTwitter
More
GitHub – React NativeScriptGitHub – Docs Site
Follow @LinguaBrowse
Copyright © 2021 Jamie Birch