UNPKG

1.65 kBTypeScriptView Raw
1import * as React from 'react';
2import { SxProps } from '@mui/system';
3import { Theme } from '..';
4import { OverridableComponent, OverrideProps } from '../OverridableComponent';
5import { CardMediaClasses } from './cardMediaClasses';
6
7export interface CardMediaOwnProps {
8 /**
9 * The content of the component.
10 */
11 children?: React.ReactNode;
12 /**
13 * Override or extend the styles applied to the component.
14 */
15 classes?: Partial<CardMediaClasses>;
16 /**
17 * Image to be displayed as a background image.
18 * Either `image` or `src` prop must be specified.
19 * Note that caller must specify height otherwise the image will not be visible.
20 */
21 image?: string;
22 /**
23 * An alias for `image` property.
24 * Available only with media components.
25 * Media components: `video`, `audio`, `picture`, `iframe`, `img`.
26 */
27 src?: string;
28 /**
29 * The system prop that allows defining system overrides as well as additional CSS styles.
30 */
31 sx?: SxProps<Theme>;
32}
33
34export interface CardMediaTypeMap<AdditionalProps, RootComponent extends React.ElementType> {
35 props: AdditionalProps & CardMediaOwnProps;
36 defaultComponent: RootComponent;
37}
38
39/**
40 *
41 * Demos:
42 *
43 * - [Card](https://mui.com/material-ui/react-card/)
44 *
45 * API:
46 *
47 * - [CardMedia API](https://mui.com/material-ui/api/card-media/)
48 */
49declare const CardMedia: OverridableComponent<CardMediaTypeMap<{}, 'div'>>;
50
51export type CardMediaProps<
52 RootComponent extends React.ElementType = 'div',
53 AdditionalProps = {},
54> = OverrideProps<CardMediaTypeMap<AdditionalProps, RootComponent>, RootComponent> & {
55 component?: React.ElementType;
56};
57
58export default CardMedia;