2019-02-19 11:42:05 +08:00
---
category: Components
type: General
title: Typography
cols: 1
2020-05-31 11:48:34 +08:00
cover: https://gw.alipayobjects.com/zos/alicdn/GOM1KQ24O/Typography.svg
2019-02-19 11:42:05 +08:00
---
2019-03-19 11:40:36 +08:00
Basic text writing, including headings, body text, lists, and more.
2019-02-19 11:42:05 +08:00
## When To Use
2019-10-25 09:56:30 +08:00
- When need to display a title or paragraph contents in Articles/Blogs/Notes.
2019-03-19 11:40:36 +08:00
- When you need copyable/editable/ellipsis texts.
2019-02-19 11:42:05 +08:00
## API
### Typography.Text
2019-07-11 14:14:33 +08:00
| Property | Description | Type | Default | Version |
| --- | --- | --- | --- | --- |
2019-11-22 10:33:34 +08:00
| code | Code style | boolean | false | |
2020-08-10 10:44:16 +08:00
| copyable | Whether to be copyable, customize it via setting an object | boolean \| [copyable ](#copyable ) | false | [copyable ](#copyable ) |
2019-11-22 10:33:34 +08:00
| delete | Deleted line style | boolean | false | |
| disabled | Disabled content | boolean | false | |
2020-08-10 10:44:16 +08:00
| editable | If editable. Can control edit state when is object | boolean \| [editable ](#editable ) | false | [editable ](#editable ) |
2020-10-12 10:49:17 +08:00
| ellipsis | Display ellipsis when text overflows | boolean | false | |
2020-05-16 14:43:29 +08:00
| keyboard | Keyboard style | boolean | false | 4.3.0 |
2020-10-21 10:33:43 +08:00
| mark | Marked style | boolean | false | |
2019-11-22 10:33:34 +08:00
| strong | Bold style | boolean | false | |
2020-08-13 10:13:32 +08:00
| type | Content type | `secondary` \| `success` \| `warning` \| `danger` | - | success: 4.6.0 |
2020-10-21 10:33:43 +08:00
| underline | Underlined style | boolean | false | |
| onChange | Trigger when user edits the content | function(string) | - | |
2019-02-19 11:42:05 +08:00
### Typography.Title
2019-07-11 14:14:33 +08:00
| Property | Description | Type | Default | Version |
| --- | --- | --- | --- | --- |
2019-11-22 10:33:34 +08:00
| code | Code style | boolean | false | |
2020-08-10 10:44:16 +08:00
| copyable | Whether to be copyable, customize it via setting an object | boolean \| [copyable ](#copyable ) | false | [copyable ](#copyable ) |
2019-11-22 10:33:34 +08:00
| delete | Deleted line style | boolean | false | |
| disabled | Disabled content | boolean | false | |
2020-08-10 10:44:16 +08:00
| editable | If editable. Can control edit state when is object | boolean \| [editable ](#editable ) | false | [editable ](#editable ) |
| ellipsis | Display ellipsis when text overflows, can configure rows and expandable by using object | boolean \| [ellipsis ](#ellipsis ) | false | [ellipsis ](#ellipsis ) |
2020-07-28 20:39:43 +08:00
| level | Set content importance. Match with `h1` , `h2` , `h3` , `h4` , `h5` | number: 1, 2, 3, 4, 5 | 1 | 5: 4.6.0 |
2019-11-22 10:33:34 +08:00
| mark | Marked style | boolean | false | |
2020-10-21 10:33:43 +08:00
| type | Content type | `secondary` \| `success` \| `warning` \| `danger` | - | success: 4.6.0 |
2019-11-22 10:33:34 +08:00
| underline | Underlined style | boolean | false | |
2020-06-30 11:25:55 +08:00
| onChange | Trigger when user edits the content | function(string) | - | |
2019-02-19 11:42:05 +08:00
### Typography.Paragraph
2019-07-11 14:14:33 +08:00
| Property | Description | Type | Default | Version |
| --- | --- | --- | --- | --- |
2019-11-22 10:33:34 +08:00
| code | Code style | boolean | false | |
2020-08-10 10:44:16 +08:00
| copyable | Whether to be copyable, customize it via setting an object | boolean \| [copyable ](#copyable ) | false | [copyable ](#copyable ) |
2019-11-22 10:33:34 +08:00
| delete | Deleted line style | boolean | false | |
| disabled | Disabled content | boolean | false | |
2020-08-10 10:44:16 +08:00
| editable | If editable. Can control edit state when is object | boolean \| [editable ](#editable ) | false | [editable ](#editable ) |
| ellipsis | Display ellipsis when text overflows, can configure rows and expandable by using object | boolean \| [ellipsis ](#ellipsis ) | false | [ellipsis ](#ellipsis ) |
2019-11-22 10:33:34 +08:00
| mark | Marked style | boolean | false | |
| strong | Bold style | boolean | false | |
2020-08-13 10:13:32 +08:00
| type | Content type | `secondary` \| `success` \| `warning` \| `danger` | - | success: 4.6.0 |
2020-10-21 10:33:43 +08:00
| underline | Underlined style | boolean | false | |
| onChange | Trigger when user edits the content | function(string) | - | |
2020-05-11 14:28:57 +08:00
2020-08-09 12:56:35 +08:00
### copyable
2020-10-21 10:33:43 +08:00
{
text: string,
onCopy: function,
icon: ReactNode,
tooltips: false | [ReactNode, ReactNode],
}
2020-08-09 12:56:35 +08:00
2020-08-10 10:44:16 +08:00
| Property | Description | Type | Default | Version |
| --- | --- | --- | --- | --- |
2020-10-21 10:33:43 +08:00
| icon | Custom copy icon: \[copyIcon, copiedIcon] | \[ReactNode, ReactNode] | - | 4.6.0 |
2020-08-10 10:44:16 +08:00
| text | The text to copy | string | - | |
2020-10-21 10:33:43 +08:00
| tooltips | Custom tooltip text, hide when it is false | \[ReactNode, ReactNode] | \[`Copy` , `Copied` ] | 4.4.0 |
2020-08-10 10:44:16 +08:00
| onCopy | Called when copied text | function | - | |
2020-08-09 12:56:35 +08:00
### editable
2020-10-21 10:33:43 +08:00
{
icon: ReactNode,
tooltip: boolean | ReactNode,
editing: boolean,
maxLength: number,
autoSize: boolean | { minRows: number, maxRows: number },
onStart: function,
onChange: function(string),
}
2020-08-10 10:44:16 +08:00
| Property | Description | Type | Default | Version |
| --- | --- | --- | --- | --- |
2020-10-21 10:33:43 +08:00
| autoSize | `autoSize` attribute of textarea | boolean \| { minRows: number, maxRows: number } | - | 4.4.0 |
2020-08-10 10:44:16 +08:00
| editing | Whether to be editable | boolean | false | |
2020-10-21 10:33:43 +08:00
| icon | Custom editable icon | ReactNode | < EditOutlined /> | 4.6.0 |
2020-08-10 10:44:16 +08:00
| maxLength | `maxLength` attribute of textarea | number | - | 4.4.0 |
2020-10-21 10:33:43 +08:00
| tooltip | Custom tooltip text, hide when it is false | boolean \| ReactNode | `Edit` | 4.6.0 |
2020-08-10 10:44:16 +08:00
| onChange | Called when input at textarea | function(event) | - | |
2020-10-21 10:33:43 +08:00
| onStart | Called when enter editable state | function | - | |
2020-08-09 12:56:35 +08:00
2020-08-10 10:44:16 +08:00
### ellipsis
2020-08-09 12:56:35 +08:00
2020-10-21 10:33:43 +08:00
{
rows: number,
expandable: boolean,
suffix: string,
symbol: ReactNode,
2021-01-27 17:26:38 +08:00
tooltip: boolean | ReactNode,
2020-10-21 10:33:43 +08:00
onExpand: function(event),
onEllipsis: function(ellipsis),
}
2020-08-09 12:56:35 +08:00
2021-01-12 16:46:59 +08:00
| Property | Description | Type | Default | Version |
| --- | --- | --- | --- | --- |
| expandable | Whether to be expandable | boolean | - | |
| rows | Max rows of content | number | - | |
2021-01-27 17:26:38 +08:00
| suffix | Suffix of ellipsis content | string | - | |
| symbol | Custom description of ellipsis | ReactNode | `Expand` | |
2021-01-12 16:46:59 +08:00
| tooltip | Show tooltip when ellipsis | boolean \| ReactNode | - | 4.11.0 |
| onEllipsis | Called when enter or leave ellipsis state | function(ellipsis) | - | 4.2.0 |
| onExpand | Called when expand content | function(event) | - | |
2020-08-09 12:56:35 +08:00
2020-05-11 14:28:57 +08:00
## FAQ
### How to use Typography.Link in react-router?
`react-router` support [customize ](https://github.com/ReactTraining/react-router/blob/master/packages/react-router-dom/docs/api/Link.md#component-reactcomponent ) render component:
```tsx
< Link to = "/" component = {Typography.Link} / >
```