UNPKG

@mskcc/carbon-react

Version:

Carbon react components for the MSKCC DSM

65 lines (64 loc) 2.36 kB
/** * MSKCC DSM 2021, 2023 */ import PropTypes from 'prop-types'; import { PropsWithChildren, ReactHTML } from 'react'; interface AspectRatioProps { /** * Provide a custom component or string to be rendered as * the outermost node of the component. This is useful if you want * to deviate from the default `div` tag, where you could specify * `section` or `article` instead. * * ```jsx * <AspectRatio as="article">My content</AspectRatio> * ``` */ as?: keyof ReactHTML; /** * Specify a class name for the outermost node * of the component. */ className?: string; /** * Specify the ratio to be used by the aspect ratio * container. This will determine what aspect ratio your content * will be displayed in. */ ratio?: '1x1' | '2x3' | '3x2' | '3x4' | '4x3' | '1x2' | '2x1' | '9x16' | '16x9'; } /** * The AspectRatio component provides a `ratio` prop that will be used to * specify the aspect ratio that the children you provide will be displayed in. * This is often useful alongside our grid components, or for media assets like * images or videos. */ declare const AspectRatio: { ({ as: BaseComponent, className: containerClassName, children, ratio, ...rest }: PropsWithChildren<AspectRatioProps>): JSX.Element; propTypes: { /** * Provide a custom component or string to be rendered as the outermost node * of the component. This is useful if you want to deviate from the default * `div` tag, where you could specify `section` or `article` instead. * * ```jsx * <AspectRatio as="article">My content</AspectRatio> * ``` */ as: PropTypes.Requireable<PropTypes.ReactComponentLike>; /** * Specify the content that will be placed in the aspect ratio */ children: PropTypes.Requireable<PropTypes.ReactNodeLike>; /** * Specify a class name for the outermost node of the component */ className: PropTypes.Requireable<string>; /** * Specify the ratio to be used by the aspect ratio container. This will * determine what aspect ratio your content will be displayed in. */ ratio: PropTypes.Requireable<string>; }; }; export default AspectRatio;