Marigold
Getting StartedFoundationsComponentsPatternsRecipesReleases
Discover new Tutorials!

Components

Overview

Application

MarigoldProvider
updated
RouterProvider
updated

Layout

Aside
Aspect
Breakout
Center
Columns
Container
Grid
Inline
Inset
Scrollable
Split
Stack
updated
Tiles

Form

Autocomplete
Button
updated
Calendar
Checkbox
ComboBox
DateField
DatePicker
Form
Multiselect
new
NumberField
Radio
SearchField
Select
Slider
Switch
TextArea
TextField
TimeField
new

Collection

SelectList
updated
Table
updated
Tag

Navigation

Accordion
Breadcrumbs
beta
Pagination
Tabs

Overlay

ContextualHelp
new
Dialog
Menu
Toast
beta
Tooltip
updated

Content

Badge
Body
Card
Divider
updated
Footer
Header
Headline
updated
Icon
updated
Image
Link
updated
List
updated
SectionMessage
SVG
updated
Text
updated
VisuallyHidden
updated
XLoader

Formatters

DateFormat
NumericFormat

Hooks and Utils

cn
cva
extendTheme
useAsyncListData
useListData
useResponsiveValue
useTheme

Text

Component for displaying text paragraphs

The <Text> component is a fundamental part of Marigold's content components. It is designed to display text in a structured and visually appealing way, making it easy to read and understand.

Anatomy

The <Text> consists of a single element that can be rendered as a <div>, <p>, or <span>. It supports various text properties such as alignment, size, weight, and color.

AppearanceTable

The appearance of a component can be customized using the variant and size props. These props adjust the visual style and dimensions of the component, available values are based on the active theme.

Variant
Size
RUI is our transformative approach to creating an intuitive and user-friendly software experience for everyone.
PropertyTypeDescription
variantdefault | mutedThe available variants of this component.
sizedefault | xs | sm | base | lg | xl | 2xl | 3xl | 4xl | 5xl | 6xl | 7xl | 8xl | 9xlThe available sizes of this component.

Usage

The <Text> component is intended for all non-heading text, such as main content, detailed descriptions, and text within other components. Use it whenever you need to display standard paragraph text.

Do
Use text component for paragraphs

Use <Text> component for paragraphs or other body text.

Don't
Dont use text component for headlines or titles

Don't use the <Text> component for headings or titles. Use the <Heading> component instead.

Rendering as other HTML elements

The <Text> component can be rendered as different HTML elements by using the as prop. This allows you to change the underlying element without losing the styling and behavior of the <Text> component.

  • Use a <p> tag for paragraphs of text.
  • Use a <span> for inline text inside a sentence or heading.
  • Use a <div> for block-level layout elements without paragraph semantics.

Customizing Text

Sometimes you want to highlight text or make it stand out from the rest of the content. The <Text> component supports a color prop that allows you to change the text color. Also you can set the weight and size of the text to make it more prominent.

Preview
Code
Ticket #47213 —
Payment not processed

Props

Did you know? You can explore, test, and customize props live in Marigold's storybook. Watch the effects they have in real-time!
View Text stories
align?
"none" | "left" | "center" | "right";
Set the text alignment for the element.
aria-describedby?
string;
Identifies the element (or elements) that describes the object.
aria-details?
string;
Identifies the element (or elements) that provide a detailed, extended description for the object.
aria-label?
string;
Defines a string value that labels the current element.
aria-labelledby?
string;
Identifies the element (or elements) that labels the current element.
as?
"div" | "span" | "p";
Element to render
Defaults to:
"div"
children?
ReactNode;
The children of the component
color?
string;
Set the text color.
Defaults to:
"currentColor"
cursor?
CursorProp;
Set the cursor for the element. You can see allowed tokens here.
fontSize?
FontSizeProp;
Set the font size for the text element. You can see allowed tokens here.
fontStyle?
"italic" | "normal";
Set the font style for the text element.
id?
string;
The element's unique identifier. See MDN.
slot?
string;
A slot name for the component. Slots allow the component to receive props from a parent component.
weight?
FontWeightProp;
Set the font weight for the text element. You can see allowed tokens here.

Alternative Component

  • Headline: Use the <Headline> component for titles and headings. It provides a more semantic structure for text that serves as a title or heading, ensuring better accessibility and SEO.
Last update: a month ago
Build with 🥵, 🧡 and
v14.1.1