diff --git a/src/components/TwitterTimelineEmbed.tsx b/src/components/TwitterTimelineEmbed.tsx index e3cae78..a899842 100644 --- a/src/components/TwitterTimelineEmbed.tsx +++ b/src/components/TwitterTimelineEmbed.tsx @@ -20,6 +20,10 @@ export interface TwitterTimelineEmbedBase { * Automatically fit into parent container height */ autoHeight?: boolean; + /** + * Automatically fit into parent container width + */ + autoWidth?: boolean; /** * With dark or light theme */ @@ -235,6 +239,9 @@ const TwitterTimelineEmbed = (props: TwitterTimelineEmbedPropsType): any => { if (props?.autoHeight) { options.height = (ref.current?.parentNode as HTMLElement)?.offsetHeight; } + if (props?.autoWidth) { + options.width = (ref.current?.parentNode as HTMLElement)?.offsetWidth; + } options = Object.assign({}, options, { theme: props?.theme,