Skip to content
QwryAI
Documentation
Pages

Widgets

Text

Text components for a Widget's words: Text, Title, Caption, Label and Markdown

Text components show every readable line in a Widget, from headings and body copy to field labels and formatted Markdown. There are five: Text, Title, Caption, Label and Markdown.

Common Props

Text, Title, Caption and Label share these props.

PropTypeDefaultDescription
valuestring | number—The text to show.
colorcolorprimary (secondary for Caption and Label)Text color. Accepts the same colors as layout components.
textAlignstart | center | endstartHorizontal alignment.
truncatebooleanfalseKeeps the text on one line and ends it with an ellipsis.
maxLinesnumber—Shows at most this many lines and hides the rest.
decimalPlacesnumber—When value is a number, rounds it to this many decimal places, such as 2 for 49.90.

Text

Body text for descriptions, values and any other copy.

jsx
<Text value={description} size="sm" color="secondary" maxLines={3} />

Props

In addition to the common props, Text accepts:

PropTypeDefaultDescription
sizexs | sm | md | lg | xlmdFont size: 12, 14, 16, 18 or 20 px.
weightnormal | medium | semibold | boldnormalFont weight.
widthnumber | string—Fixed width.
italicbooleanfalseItalic text.
lineThroughbooleanfalseStrikes the text through, for example an old price.
tabularNumsbooleanfalseGives every digit the same width so numbers line up.
minLinesnumber—The least number of lines the text takes up.
streamingbooleanfalseShows the text with a fade-in, as if it were being written.
editableobject—Turns the text into an inline field the visitor can edit. See below.

Editable text

Give editable an object and the text becomes a field the visitor can change in place. Its value is stored under editable.name, like any form input.

jsx
<Text value={nickname} editable={{ name: "nickname", placeholder: "Add a nickname", required: true }} />

editable takes name, placeholder, required, pattern, autoFocus, autoSelect, allowAutofillExtensions, autoComplete and onChangeAction. Set minLines or maxLines to edit several lines.

Title

Headings for cards and sections.

jsx
<Title value="Order summary" size="lg" />

Props

In addition to the common props, Title accepts:

PropTypeDefaultDescription
sizesm | md | lg | xl | 2xl | 3xl | 4xl | 5xlmdFont size: 18, 20, 24, 32, 36, 48, 60 or 72 px.
weightnormal | medium | semibold | boldmediumFont weight.
tabularNumsbooleanfalseGives every digit the same width.

Caption

Small secondary text for notes, dates and supporting details.

jsx
<Caption value="Estimated delivery Thu, 4 Dec" />

Props

In addition to the common props, Caption accepts:

PropTypeDefaultDescription
sizesm | md | lgmdFont size: 11, 12 or 14 px.
weightnormal | medium | semibold | boldnormalFont weight.

Label

A label for a form field. Put it above an Input, Select or other control and set fieldName to the control's name.

jsx
<Label value="Email address" fieldName="email" />
<Input name="email" inputType="email" placeholder="you@example.com" />

Props

In addition to the common props, Label accepts:

PropTypeDefaultDescription
fieldNamestring—The name of the field this label belongs to.
sizexs | sm | md | lg | xlmdFont size: 12, 14, 16, 18 or 20 px.
weightnormal | medium | semibold | boldmediumFont weight.

Markdown

Formatted text written in Markdown, including headings, lists, links, tables and code. Links open in a new tab.

jsx
<Markdown value={returnPolicy} />

Props

PropTypeDefaultDescription
valuestring—The Markdown to show.
streamingbooleanfalseShows the text with a fade-in, as if it were being written.

Next steps

Explore the documentation