react-aspect-ratio
Version:
React Component to maintain a consistent width-to-height ratio (aspect ratio), preventing cumulative layout shift.
14 lines (13 loc) • 398 B
TypeScript
import { Component } from 'react';
import type { Props } from './types';
declare class AspectRatio extends Component<Props> {
static defaultProps: {
className: string;
ratio: number;
};
node: HTMLDivElement;
componentDidUpdate(): void;
setNode: (node: HTMLDivElement) => void;
render(): import("react/jsx-runtime").JSX.Element;
}
export default AspectRatio;