1 | import * as React from 'react';
|
2 | import { OverridableStringUnion } from '@mui/types';
|
3 | import { SxProps } from '@mui/system';
|
4 | import { Theme } from '..';
|
5 | import { OverridableComponent, OverrideProps } from '../OverridableComponent';
|
6 | import { ChipClasses } from './chipClasses';
|
7 |
|
8 | export interface ChipPropsVariantOverrides {}
|
9 |
|
10 | export interface ChipPropsSizeOverrides {}
|
11 |
|
12 | export interface ChipPropsColorOverrides {}
|
13 |
|
14 | export interface ChipOwnProps {
|
15 | /**
|
16 | * The Avatar element to display.
|
17 | */
|
18 | avatar?: React.ReactElement<unknown>;
|
19 | /**
|
20 | * This prop isn't supported.
|
21 | * Use the `component` prop if you need to change the children structure.
|
22 | */
|
23 | children?: null;
|
24 | /**
|
25 | * Override or extend the styles applied to the component.
|
26 | */
|
27 | classes?: Partial<ChipClasses>;
|
28 | /**
|
29 | * If `true`, the chip will appear clickable, and will raise when pressed,
|
30 | * even if the onClick prop is not defined.
|
31 | * If `false`, the chip will not appear clickable, even if onClick prop is defined.
|
32 | * This can be used, for example,
|
33 | * along with the component prop to indicate an anchor Chip is clickable.
|
34 | * Note: this controls the UI and does not affect the onClick event.
|
35 | */
|
36 | clickable?: boolean;
|
37 | /**
|
38 | * The color of the component.
|
39 | * It supports both default and custom theme colors, which can be added as shown in the
|
40 | * [palette customization guide](https://mui.com/material-ui/customization/palette/#custom-colors).
|
41 | * @default 'default'
|
42 | */
|
43 | color?: OverridableStringUnion<
|
44 | 'default' | 'primary' | 'secondary' | 'error' | 'info' | 'success' | 'warning',
|
45 | ChipPropsColorOverrides
|
46 | >;
|
47 | /**
|
48 | * Override the default delete icon element. Shown only if `onDelete` is set.
|
49 | */
|
50 | deleteIcon?: React.ReactElement<unknown>;
|
51 | /**
|
52 | * If `true`, the component is disabled.
|
53 | * @default false
|
54 | */
|
55 | disabled?: boolean;
|
56 | /**
|
57 | * Icon element.
|
58 | */
|
59 | icon?: React.ReactElement<unknown>;
|
60 | /**
|
61 | * The content of the component.
|
62 | */
|
63 | label?: React.ReactNode;
|
64 | /**
|
65 | * Callback fired when the delete icon is clicked.
|
66 | * If set, the delete icon will be shown.
|
67 | */
|
68 | onDelete?: React.EventHandler<any>;
|
69 | /**
|
70 | * The size of the component.
|
71 | * @default 'medium'
|
72 | */
|
73 | size?: OverridableStringUnion<'small' | 'medium', ChipPropsSizeOverrides>;
|
74 | /**
|
75 | * If `true`, allows the disabled chip to escape focus.
|
76 | * If `false`, allows the disabled chip to receive focus.
|
77 | * @default false
|
78 | */
|
79 | skipFocusWhenDisabled?: boolean;
|
80 | /**
|
81 | * The system prop that allows defining system overrides as well as additional CSS styles.
|
82 | */
|
83 | sx?: SxProps<Theme>;
|
84 | /**
|
85 | * @ignore
|
86 | */
|
87 | tabIndex?: number;
|
88 | /**
|
89 | * The variant to use.
|
90 | * @default 'filled'
|
91 | */
|
92 | variant?: OverridableStringUnion<'filled' | 'outlined', ChipPropsVariantOverrides>;
|
93 | }
|
94 |
|
95 | export interface ChipTypeMap<
|
96 | AdditionalProps = {},
|
97 | RootComponent extends React.ElementType = 'div',
|
98 | > {
|
99 | props: AdditionalProps & ChipOwnProps;
|
100 | defaultComponent: RootComponent;
|
101 | }
|
102 |
|
103 | /**
|
104 | * Chips represent complex entities in small blocks, such as a contact.
|
105 | *
|
106 | * Demos:
|
107 | *
|
108 | * - [Chip](https://mui.com/material-ui/react-chip/)
|
109 | *
|
110 | * API:
|
111 | *
|
112 | * - [Chip API](https://mui.com/material-ui/api/chip/)
|
113 | */
|
114 | declare const Chip: OverridableComponent<ChipTypeMap>;
|
115 |
|
116 | export type ChipProps<
|
117 | RootComponent extends React.ElementType = ChipTypeMap['defaultComponent'],
|
118 | AdditionalProps = {},
|
119 | > = OverrideProps<ChipTypeMap<AdditionalProps, RootComponent>, RootComponent> & {
|
120 | component?: React.ElementType;
|
121 | };
|
122 |
|
123 | export default Chip;
|