Debian Codegraph @

node/@patternfly/react-table/src/deprecated/components/Table/examples/LegacyTableTextModifiers.tsx

raw
1 import { cellWidth, TableText } from '@patternfly/react-table';
2 import { Table, TableHeader, TableBody, TableProps } from '@patternfly/react-table/deprecated';
3
4 // This example has been simplified to focus on the text modifier props. In real usage,
5 // you may want to derive your rows from typed underlying data and minimal state. See other examples.
6
7 export const LegacyTableTextModifiers: React.FunctionComponent = () => {
8 const columns: TableProps['cells'] = [
9 { title: 'Truncating text', transforms: [cellWidth(30)] },
10 { title: 'Wrapping table header text. This th text will wrap instead of truncate.' }
11 ];
12 const rows: TableProps['rows'] = [
13 [
14 { title: <TableText wrapModifier="truncate">This text will truncate instead of wrap.</TableText> },
15 {
16 title: (
17 <TableText wrapModifier="nowrap">
18 <a href="#">This is a link that needs to be on one line and fully readable.</a>
19 </TableText>
20 )
21 }
22 ]
23 ];
24
25 return (
26 <Table aria-label="Table text with modifiers" cells={columns} rows={rows}>
27 <TableHeader />
28 <TableBody />
29 </Table>
30 );
31 };