|
@@ -324,10 +324,13 @@ Show ellipsis if text is overflowed. Refer to [Ellipsis Config](#Ellipsis-Config
|
|
|
|
|
|
```jsx live=true
|
|
```jsx live=true
|
|
import React from 'react';
|
|
import React from 'react';
|
|
-import { Typography } from '@douyinfe/semi-ui';
|
|
|
|
|
|
+import { Typography, Tooltip } from '@douyinfe/semi-ui';
|
|
|
|
|
|
function Demo() {
|
|
function Demo() {
|
|
const { Paragraph, Text, Title } = Typography;
|
|
const { Paragraph, Text, Title } = Typography;
|
|
|
|
+ const customRenderTooltip = useCallback((content, children) => {
|
|
|
|
+ return <Tooltip content={content} style={{ backgroundColor: 'var(--semi-color-primary)' }}>{children}</Tooltip>;
|
|
|
|
+ }, []);
|
|
|
|
|
|
return (
|
|
return (
|
|
<div>
|
|
<div>
|
|
@@ -365,6 +368,19 @@ function Demo() {
|
|
<Paragraph ellipsis={{ rows: 3, expandable: true, collapsible: true, collapseText: 'Show Less', onExpand: (bool, e) => console.log(bool, e) }} style={{ width: 300 }}>
|
|
<Paragraph ellipsis={{ rows: 3, expandable: true, collapsible: true, collapseText: 'Show Less', onExpand: (bool, e) => 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.`}
|
|
{`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.`}
|
|
</Paragraph>
|
|
</Paragraph>
|
|
|
|
+ <br />
|
|
|
|
+ <Title
|
|
|
|
+ heading={6}
|
|
|
|
+ ellipsis={{
|
|
|
|
+ showTooltip: {
|
|
|
|
+ renderTooltip: customRenderTooltip
|
|
|
|
+ }
|
|
|
|
+ }}
|
|
|
|
+ style={{ width: 250 }}
|
|
|
|
+
|
|
|
|
+ >
|
|
|
|
+ Custom tooltip with a blue background color
|
|
|
|
+ </Title>
|
|
</div>
|
|
</div>
|
|
);
|
|
);
|
|
}
|
|
}
|
|
@@ -517,7 +533,7 @@ function Demo() {
|
|
| expandable | Toggle whether text is expandable | boolean | false |
|
|
| expandable | Toggle whether text is expandable | boolean | false |
|
|
| pos | Position to start ellipsis, one of `end`, `middle` | string | `end` |
|
|
| pos | Position to start ellipsis, one of `end`, `middle` | string | `end` |
|
|
| rows | Number of rows that should not be truncated | number | 1 |
|
|
| 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 | boolean\|{type: 'tooltip'\|'popover', opts: object} | false |
|
|
|
|
|
|
+| 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 | - |
|
|
| suffix | Text suffix that will not be truncated | string | - |
|
|
| onExpand | Callback when expand or collapse | function(expanded: bool, Event: e) | - |
|
|
| onExpand | Callback when expand or collapse | function(expanded: bool, Event: e) | - |
|
|
|
|
|