---
localeCode: en-US
order: 21
category: Basic
title: Typography
subTitle: Typography
icon: doc-typography
brief: The basic format of text, images, paragraphs, and numeric.
---
## When to Use
- To display the text content of articles, blogs, logs, etc.
- To take basic operations such as copying and omitting text.
## Demos
### How to import
```jsx import
import { Typography } from '@douyinfe/semi-ui';
```
### Title
Use `heading` to set different levels of headint title.
```jsx live=true
import React from 'react';
import { Typography } from '@douyinfe/semi-ui';
function Demo() {
const { Title } = Typography;
return (
);
}
```
### Text
Text component has different built-in styles. You could also pass `icon` to use the build-in styles for icon. Different from passing icon to children, using `icon` for link will have no underline in compliance with Semi Design principles.
```jsx live=true
import React from 'react';
import { Typography } from '@douyinfe/semi-ui';
function Demo() {
const { Text } = Typography;
return (
4. For more information on ellipsis see FAQ
```jsx live=true
import React from 'react';
import { Typography, Tooltip } from '@douyinfe/semi-ui';
function Demo() {
const { Paragraph, Text, Title } = Typography;
const customRenderTooltip = useCallback((content, children) => {
return {children};
}, []);
return (
This is a supercalifragilisticexpialidocious title
Custom tooltip text if you need
This is a supercalifragilisticexpialidocious link
{`With suffix: Life's but a walking shadow, a poor player, that struts and frets his hour upon the stage, and then is heard no more; it is a tale told by an idiot, full of sound and fury, signifying nothing.`}
{`Multi-line ellipsis: Life's but a walking shadow, a poor player, that struts and frets his hour upon the stage, and then is heard no more; it is a tale told by an idiot, full of sound and fury, signifying nothing.`}
{`With Popover: Life's but a walking shadow, a poor player, that struts and frets his hour upon the stage, and then is heard no more; it is a tale told by an idiot, full of sound and fury, signifying nothing.`}
console.log(bool, e) }} style={{ width: 300 }}>
{`Expandable and collapsible: Life's but a walking shadow, a poor player, that struts and frets his hour upon the stage, and then is heard no more; it is a tale told by an idiot, full of sound and fury, signifying nothing.`}
Custom tooltip with a blue background color
);
}
```
When the tooltip does not wrap in the pop-up tooltip when the long text occurs, please set it manually through word-break or word-wrap, more details can be found in the FAQ section of Tooltip
```jsx live=true
import React from 'react';
import { Typography } from '@douyinfe/semi-ui';
function Demo() {
const { Text } = Typography;
return (
Customized configuration can be made on demand when long text is truncated
Customized configuration can be made on demand when long text is truncated
Customized configuration can be made on demand when long text is truncated
);
}
```
```scss
// config word-break
.components-typography-demo {
word-break: break-word;
// or
word-break: break-all;
}
```
## API Reference
### Typography.Text
| Properties | Instructions | type | Default | version |
| ---------- |------------------------------------------------------------------------------------------------------------------------------------------| ----------------------------------------------------- | --------- | ------- |
| copyable | Toggle whether to be copyable | boolean \| object:[Copyable Config](#Copyable-Config) | false | |
| code | wrap with `code` element | boolean | - | |
| component | Custom rendering html element | html element | span | |
| delete | Deleted style | boolean | false | |
| disabled | Disabled style | boolean | false | |
| ellipsis | Display ellipsis when text overflows | boolean\|object:Ellipsis Config | false | |
| icon | Prefix icon. | ReactNode | - | |
| link | Toggle whether to display as a link. When passing object, the attributes will be transparently passed to the a tag | boolean\|object | false | |
| mark | Marked style | boolean | false | |
| size | Size, one of `normal`, `small`, `inherit` | string | `normal` | |
| strong | Bold style | boolean | false | |
| type | Type, one of `primary`, `secondary`, `warning`, `danger`, `tertiary`(**v>=1.2.0**) , `quaternary`(**v>=1.2.0**), `success`(**v>=1.7.0**) | string | `primary` | |
| underline | Underlined style | boolean | false | |
| weight | set font weight | number | | 2.34.0 |
### Typography.Title
| Properties | Instructions | type | Default | version |
| ---------- |-----------------------------------------------------------------------------------------------------------------------------------------| ----------------------------------------------------- | --------- | ------- |
| copyable | Toggle whether to be copyable | boolean \| object:[Copyable Config](#Copyable-Config) | false | |
| component | Custom rendering html element. The default is determined by heading prop | html element | h1~h6 | |
| delete | Deleted style | boolean | false | |
| disabled | Disabled style | boolean | false | |
| ellipsis | Display ellipsis when text overflows | boolean\|object:Ellipsis Config | false | |
| heading | Heading level, one of 1, 2, 3,4,5,6 | number | 1 | |
| link | Toggle whether to display as a link. When passing object, the attributes will be transparently passed to the a tag | boolean\|object | false | |
| mark | Marked style | boolean | false | |
| type | Type, one of `primary`, `secondary`, `warning`, `danger`, `tertiary`(**v>=1.2.0**), `quaternary`(**v>=1.2.0**), `success`(**v>=1.7.0**) | string | `primary` | |
| underline | Underlined style | boolean | false | |
| weight | set font weight, one of `light`, `regular`, `medium`, `semibold`, `bold`, `default` | string, number | | 2.34.0 |
### Typography.Paragraph
| Properties | Instructions | type | Default | version |
| ---------- | --------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------- | --------- | ------- |
| copyable | Toggle whether to be copyable | boolean \| object:[Copyable Config](#Copyable-Config) | false | |
| component | Custom rendering html element | html element | p | |
| delete | Deleted style | boolean | false | |
| disabled | Disabled style | boolean | false | |
| ellipsis | Display ellipsis when text overflows | boolean\|object:Ellipsis Config | false | |
| link | Toggle whether to display as a link. When passing object, the attributes will be transparently passed to the a tag | boolean\|object | false | |
| mark | Marked style | boolean | false | |
| size | Size, one of `normal`,`small` | string | `normal` | |
| spacing | paragraph spacing, one of `normal`, `extended` | string | `normal` | |
| strong | Bold style | boolean | false | |
| type | Type, one of `primary`, `secondary`, `warning`, `danger`, `tertiary`(**v>=1.2.0**), `quaternary`(**v>=1.2.0**), `success`(**v>=1.7.0**) | string | `primary` | |
| underline | Underlined style | boolean | false | |
### Typography.Numeral
| Properties | Instructions | type | Default | version |
| ---------- |-----------------------------------------------------------------------------------------------------------------------------------------|-----------------------|--------------------------------------------|---------|
| rule | Parsing rules, one of `text`, `numbers`, `bytes-decimal`, `bytes-binary`, `percentages`, `currency`, `exponential` | string | `text` | 2.22.0 |
| precision | allows you to set the number of decimal places to be retained, used to set precision | number | 0 | 2.22.0 |
| truncate | The truncation of the number of decimal places, optionally `ceil`, `floor`, `round`, aligned with Math.ceil, Math.floor, Math.round | string | `round` | 2.22.0 |
| parser | Custom numeral parsing functions | (str: string) => string | - | 2.22.0 |
| copyable | Toggle whether to be copyable | boolean \| object:[Copyable Config](#Copyable-Config) | false | 2.22.0 |
| code | wrap with `code` element | boolean | - | 2.22.0 |
| component | Custom rendering html element | html element | span | 2.22.0 |
| delete | Deleted style | boolean | false | 2.22.0 |
| disabled | Disabled style | boolean | false | 2.22.0 |
| ellipsis | Display ellipsis when text overflows | boolean \| object:Ellipsis Config | false | 2.22.0 |
| icon | Prefix icon. | ReactNode | - | 2.22.0 |
| link | Toggle whether to display as a link. When passing object, the attributes will be transparently passed to the a tag | boolean \| object | false | 2.22.0 |
| mark | Marked style | boolean | false | 2.22.0 |
| size | Size, one of `normal`,`small` | string | `normal` | 2.22.0 |
| strong | Bold style | boolean | false | 2.22.0 |
| type | Type, one of `primary`, `secondary`, `warning`, `danger`, `tertiary`(**v>=1.2.0**) , `quaternary`(**v>=1.2.0**), `success`(**v>=1.7.0**) | string | `primary` | 2.22.0 |
| underline | Underlined style | boolean | false | 2.22.0 |
### Ellipsis Config
| Properties | Instructions | type | Default |
| ------------ | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | --------------------------------------------------- | ---------- |
| collapseText | Displayed text to collapse | string | `Collapse` |
| collapsible | Toggle whether text is collapsible | boolean | false |
| expandText | Displayed text to expand | string | `Expand` |
| expandable | Toggle whether text is expandable | boolean | false |
| pos | Position to start ellipsis, one of `end`, `middle` | string | `end` |
| rows | Number of rows that should not be truncated | number | 1 |
| showTooltip | Toggle whether to show tooltip, if passed in as object: type,type of component to show tooltip, one of `Tooltip`, `Popover`; opts, properties that will be passed directly to the component; renderTooltip, custom rendering popup layer component | boolean\|{type: 'tooltip'\|'popover', opts: object, renderTooltip: ((content: ReactNode, children: ReactNode)) => ReactNode} | false |
| suffix | Text suffix that will not be truncated | string | - |
| onExpand | Callback when expand or collapse | function(expanded: bool, Event: e) | - |
### Copyable Config
| Properties | Instructions | Type | Default | Version |
| ---------- | --------------------------------------- | ---------------------------------------------- | ------- | ------- |
| content | Copied content | string | - | |
| copyTip | Tooltip content when hovering over icon | React.node | - | |
| icon | Custom render duplicate node | React.node | - | 2.31.0 |
| onCopy | Callback for copy action | Function(e:Event, content:string, res:boolean) | - | |
| render | Custom render copy node | function(copied, doCopy, configs) | - | 2.65.0 |
| successTip | Successful tip content | React.node | - | |
## Content Guidelines
- Link
- Text links need to be clear and predictable, users should be able to predict what will happen when they click on the link
- Do not mislead users by mislabeling links
- Avoid using "Click here" or "Here" as stand-alone links
| ✅ Recommended usage | ❌ Deprecated usage |
| --- | --- |
| No spaces yet? Create space | No spaces yet? Click here |
- Avoid using entire sentences as clickable text links, and instead use text that describes where to go as the link content
| ✅ Recommended usage | ❌ Deprecated usage |
| --- | --- |
| Views user documentation for details|View user documentation for details |
- Using short terms or words as link text is more conducive to internationalization, to avoid the problem of link text being split due to different grammar and word order in different languages
| ✅ Recommended usage | ❌ Deprecated usage |
| --- | --- |
| Manage notifications to| Manage notifications to |
- When ending with a text link, there is no need to follow punctuation, except for the question mark "?"
| ✅ Recommended usage | ❌ Deprecated usage |
| --- | --- |
| No spaces yet? Create space | No spaces yet? Click here |
| Forgot password ? |Forgot password |
- Link text does not contain the articles "the, a, an"
| ✅ Recommended usage | ❌ Deprecated usage |
| --- | --- |
| View user documentation for details| View the user documentation for details |
## Design Tokens
## FAQ
- **What are the specific mechanism and precautions of Typography ellipsis?**
Semi ellipsis has two strategies, CSS ellipsis and JS ellipsis. When setting middle truncation (pos='middle')、 expandable、 suffix is not empty string、copyable, the JS ellipsis strategy is enabled. Otherwise, enable the CSS ellipsis strategy.
In general CSS truncation performance is better than JS truncation. when the children and container size remain unchanged, CSS truncation only involves 1~2 calculations, while js truncation is based on dichotomy and may require multiple calculations.
Pay attention to performance consumption when using a large number of Typography with ellipsis. For example, in Table, you can reduce performance loss by setting a reasonable pageSize for paging.