diff --git a/src/components/utils/Flex.tsx b/src/components/utils/Flex.tsx index ae5704d247..9ce9257b50 100644 --- a/src/components/utils/Flex.tsx +++ b/src/components/utils/Flex.tsx @@ -7,14 +7,14 @@ Please see LICENSE files in the repository root for full details. */ import classNames from "classnames"; -import React, { useEffect, useRef } from "react"; +import React, { ComponentProps, JSXElementConstructor, useEffect, useRef } from "react"; -type FlexProps = { +type FlexProps> = { /** * The type of the HTML element * @default div */ - as?: string; + as?: T; /** * The CSS class name. */ @@ -30,7 +30,7 @@ type FlexProps = { */ direction?: "row" | "column" | "row-reverse" | "column-reverse"; /** - * The alingment of the flex children + * The alignment of the flex children * @default start */ align?: "start" | "center" | "end" | "baseline" | "stretch"; @@ -48,12 +48,12 @@ type FlexProps = { * the on click event callback */ onClick?: (e: React.MouseEvent) => void; -}; +} & ComponentProps; /** * A flexbox container helper */ -export function Flex({ +export function Flex = "div">({ as = "div", display = "flex", direction = "row", @@ -63,7 +63,7 @@ export function Flex({ className, children, ...props -}: React.PropsWithChildren): JSX.Element { +}: React.PropsWithChildren>): JSX.Element { const ref = useRef(); useEffect(() => {