UNPKG

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