Socket
Socket
Sign inDemoInstall

@commercetools-uikit/text

Package Overview
Dependencies
107
Maintainers
3
Versions
752
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

    @commercetools-uikit/text

The Text component implements the typography elements such as headings, paragraphs, etc.


Version published
Weekly downloads
20K
increased by61.43%
Maintainers
3
Created
Weekly downloads
 

Readme

Source

Typography: Text

Description

The Text component implements the typography elements such as headings, paragraphs, etc.

<Text.Headline>

Wraps the given text in the given HTML header size.

Usage

import Text from '@commercetools-uikit/text';

<Text.Headline as="h1">{'The title'}</Text.Headline>;

Properties

PropsTypeRequiredValuesDefaultDescription
asString['h1', 'h2', 'h3']--
childrenPropTypes.node✅ (*)---
intlMessageintl message✅ (*)--An intl message object that will be rendered with FormattedMessage
idString---Used as HTML id property
titleString---Text to show in a tooltip on hover over the element
truncateBool--falseOption for truncate content in case the screen has small width

*: children is required only if intlMessage is not provided

The component further forwards all data- attributes to the underlying component.

Where to use

Title of pages.

<Text.Subheadline>

Wraps the given text in the given HTML header size.

Usage

import Text from '@commercetools-uikit/text';

<Text.Subheadline as="h4">{'The subtitle'}</Text.Subheadline>;

Properties

PropsTypeRequiredValuesDefault
asString['h4', 'h5']-
idString---Used as HTML id property
isBoldBoolean--false
toneString-['primary', 'secondary', 'information', 'positive', 'negative']-
childrenPropTypes.node✅ (*)--
intlMessageintl message✅ (*)--An intl message object that will be rendered with FormattedMessage
titleString---
truncateBool--false

*: children is required only if intlMessage is not provided

The component further forwards all data- attributes to the underlying component.

Where to use

Subtitle of pages.

<Text.Wrap>

Wraps the given text in its container. And for long text, text will be wrapped to new line.

Usage

import Text from '@commercetools-uikit/text';

<Text.Wrap>{'Sooo long text'}</Text.Wrap>;

Where to use

When we render value that may be vey long, and we prefer to wrap text to new line after it exceeds its wrapper's width.

<Text.Body>

Wraps the given text in a <p> element, for normal content.

Usage

import Text from '@commercetools-uikit/text';

<Text.Body>{'This is a content'}</Text.Body>;

Properties

PropsTypeRequiredValuesDefault
asString-['p', 'span']-
idString---Used as HTML id property
isBoldBoolean--false
isItalicBoolean--false
isStrikethroughBoolean--false
toneString-['primary', 'secondary', 'information', 'positive', 'negative', 'inverted']-
childrenPropTypes.node✅ (*)--
intlMessageintl message✅ (*)--An intl message object that will be rendered with FormattedMessage
titleString---
truncateBool--false

*: children is required only if intlMessage is not provided

The component further forwards all data- attributes to the underlying component.

Where to use

Content text in general.

<Text.Detail>

Wraps the given text in a <small> semantic tag. It accepts a tone prop to properly style the text.

Usage

import Text from '@commercetools-uikit/text';

<Text.Detail>{'This would be something small'}</Text.Detail>
<Text.Detail tone="secondary">{'This would be something small with the secondary tone applied'}</Text.Detail>

Properties

PropsTypeRequiredValuesDefault
asstring-['small', 'span'] [^]false
idString---Used as HTML id property
isBoldBoolean--false
isItalicBoolean--false
isStrikethroughBoolean--false
toneString-['primary', 'secondary', 'information', 'positive', 'negative', 'warning'']-
childrenPropTypes.node✅ (*)--
intlMessageintl message✅ (*)--An intl message object that will be rendered with FormattedMessage
titleString---
truncateBool--false
aria-labelledbyString---HTML ID of an element containing the label for the text rendered in this component

*: children is required only if intlMessage is not provided. [^]: Use as prop to render an inline element.

The component further forwards all data- attributes to the underlying component.

Where to use

Details text of form boxes.

Keywords

FAQs

Last updated on 10 Feb 2023

Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc