UNPKG

2.11 kBTypeScriptView Raw
1import * as React from 'react';
2import { StandardProps } from '..';
3import { TypographyProps } from '../Typography';
4
5export interface ListItemTextProps<
6 PrimaryTypographyComponent extends React.ElementType = 'span',
7 SecondaryTypographyComponent extends React.ElementType = 'p'
8> extends StandardProps<React.HTMLAttributes<HTMLDivElement>, ListItemTextClassKey> {
9 /**
10 * Alias for the `primary` prop.
11 */
12 children?: React.ReactNode;
13 /**
14 * If `true`, the children won't be wrapped by a Typography component.
15 * This can be useful to render an alternative Typography variant by wrapping
16 * the `children` (or `primary`) text, and optional `secondary` text
17 * with the Typography component.
18 */
19 disableTypography?: boolean;
20 /**
21 * If `true`, the children will be indented.
22 * This should be used if there is no left avatar or left icon.
23 */
24 inset?: boolean;
25 /**
26 * The main content element.
27 */
28 primary?: React.ReactNode;
29 /**
30 * These props will be forwarded to the primary typography component
31 * (as long as disableTypography is not `true`).
32 */
33 primaryTypographyProps?: TypographyProps<
34 PrimaryTypographyComponent,
35 { component?: PrimaryTypographyComponent }
36 >;
37 /**
38 * The secondary content element.
39 */
40 secondary?: React.ReactNode;
41 /**
42 * These props will be forwarded to the secondary typography component
43 * (as long as disableTypography is not `true`).
44 */
45 secondaryTypographyProps?: TypographyProps<
46 SecondaryTypographyComponent,
47 { component?: SecondaryTypographyComponent }
48 >;
49}
50
51export type ListItemTextClassKey =
52 | 'root'
53 | 'multiline'
54 | 'dense'
55 | 'inset'
56 | 'primary'
57 | 'secondary';
58/**
59 *
60 * Demos:
61 *
62 * - [Lists](https://mui.com/components/lists/)
63 *
64 * API:
65 *
66 * - [ListItemText API](https://mui.com/api/list-item-text/)
67 */
68export default function ListItemText<
69 PrimaryTypographyComponent extends React.ElementType = 'span',
70 SecondaryTypographyComponent extends React.ElementType = 'p'
71>(props: ListItemTextProps<PrimaryTypographyComponent, SecondaryTypographyComponent>): JSX.Element;