1 | import * as React from 'react';
|
2 | import { SxProps } from '@mui/system';
|
3 | import { Theme } from '../styles';
|
4 | import { OverridableComponent, OverrideProps } from '../OverridableComponent';
|
5 | import { ListItemClasses } from './listItemClasses';
|
6 |
|
7 | export interface ListItemComponentsPropsOverrides {}
|
8 |
|
9 | /**
|
10 | * This type is kept for compatibility. Use `ListItemOwnProps` instead.
|
11 | */
|
12 | export interface ListItemBaseProps {
|
13 | /**
|
14 | * Defines the `align-items` style property.
|
15 | * @default 'center'
|
16 | */
|
17 | alignItems?: 'flex-start' | 'center';
|
18 | /**
|
19 | * The content of the component if a `ListItemSecondaryAction` is used it must
|
20 | * be the last child.
|
21 | */
|
22 | children?: React.ReactNode;
|
23 | /**
|
24 | * Override or extend the styles applied to the component.
|
25 | */
|
26 | classes?: Partial<ListItemClasses>;
|
27 | /**
|
28 | * The container component used when a `ListItemSecondaryAction` is the last child.
|
29 | * @default 'li'
|
30 | * @deprecated Use the `component` or `slots.root` prop instead. This prop will be removed in v7. See [Migrating from deprecated APIs](https://mui.com/material-ui/migration/migrating-from-deprecated-apis/) for more details.
|
31 | */
|
32 | ContainerComponent?: React.ElementType<React.HTMLAttributes<HTMLDivElement>>;
|
33 | /**
|
34 | * Props applied to the container component if used.
|
35 | * @default {}
|
36 | * @deprecated Use the `slotProps.root` prop instead. This prop will be removed in v7. See [Migrating from deprecated APIs](https://mui.com/material-ui/migration/migrating-from-deprecated-apis/) for more details.
|
37 | */
|
38 | ContainerProps?: React.HTMLAttributes<HTMLDivElement>;
|
39 | /**
|
40 | * If `true`, compact vertical padding designed for keyboard and mouse input is used.
|
41 | * The prop defaults to the value inherited from the parent List component.
|
42 | * @default false
|
43 | */
|
44 | dense?: boolean;
|
45 | /**
|
46 | * If `true`, the left and right padding is removed.
|
47 | * @default false
|
48 | */
|
49 | disableGutters?: boolean;
|
50 | /**
|
51 | * If `true`, all padding is removed.
|
52 | * @default false
|
53 | */
|
54 | disablePadding?: boolean;
|
55 | /**
|
56 | * If `true`, a 1px light border is added to the bottom of the list item.
|
57 | * @default false
|
58 | */
|
59 | divider?: boolean;
|
60 | /**
|
61 | * The element to display at the end of ListItem.
|
62 | */
|
63 | secondaryAction?: React.ReactNode;
|
64 | /**
|
65 | * The system prop that allows defining system overrides as well as additional CSS styles.
|
66 | */
|
67 | sx?: SxProps<Theme>;
|
68 | }
|
69 |
|
70 | export interface ListItemOwnProps extends ListItemBaseProps {
|
71 | /**
|
72 | * The components used for each slot inside.
|
73 | *
|
74 | * @deprecated Use the `slots` prop instead. This prop will be removed in v7. See [Migrating from deprecated APIs](https://mui.com/material-ui/migration/migrating-from-deprecated-apis/) for more details.
|
75 | * @default {}
|
76 | */
|
77 | components?: {
|
78 | Root?: React.ElementType;
|
79 | };
|
80 | /**
|
81 | * The extra props for the slot components.
|
82 | * You can override the existing props or add new ones.
|
83 | *
|
84 | * @deprecated Use the `slotProps` prop instead. This prop will be removed in v7. See [Migrating from deprecated APIs](https://mui.com/material-ui/migration/migrating-from-deprecated-apis/) for more details.
|
85 | * @default {}
|
86 | */
|
87 | componentsProps?: {
|
88 | root?: React.HTMLAttributes<HTMLDivElement> & ListItemComponentsPropsOverrides;
|
89 | };
|
90 | /**
|
91 | * The extra props for the slot components.
|
92 | * You can override the existing props or add new ones.
|
93 | *
|
94 | * @default {}
|
95 | */
|
96 | slotProps?: {
|
97 | root?: React.HTMLAttributes<HTMLDivElement> & ListItemComponentsPropsOverrides;
|
98 | };
|
99 | /**
|
100 | * The components used for each slot inside.
|
101 | *
|
102 | * @default {}
|
103 | */
|
104 | slots?: {
|
105 | root?: React.ElementType;
|
106 | };
|
107 | }
|
108 |
|
109 | export interface ListItemTypeMap<AdditionalProps, RootComponent extends React.ElementType> {
|
110 | props: AdditionalProps & ListItemOwnProps;
|
111 | defaultComponent: RootComponent;
|
112 | }
|
113 |
|
114 | /**
|
115 | * Uses an additional container component if `ListItemSecondaryAction` is the last child.
|
116 | *
|
117 | * Demos:
|
118 | *
|
119 | * - [Lists](https://mui.com/material-ui/react-list/)
|
120 | * - [Transfer List](https://mui.com/material-ui/react-transfer-list/)
|
121 | *
|
122 | * API:
|
123 | *
|
124 | * - [ListItem API](https://mui.com/material-ui/api/list-item/)
|
125 | */
|
126 | declare const ListItem: OverridableComponent<ListItemTypeMap<{}, 'li'>>;
|
127 |
|
128 | export type ListItemProps<
|
129 | RootComponent extends React.ElementType = 'li',
|
130 | AdditionalProps = {},
|
131 | > = OverrideProps<ListItemTypeMap<AdditionalProps, RootComponent>, RootComponent> & {
|
132 | component?: React.ElementType;
|
133 | };
|
134 |
|
135 | export default ListItem;
|