Skip to content

Commit

Permalink
Add flexible tagName support to PanelProps with keyof HTMLElementTagN…
Browse files Browse the repository at this point in the history
…ameMap (#407)
  • Loading branch information
in-ch committed Sep 27, 2024
1 parent 7c8daad commit c365aec
Showing 1 changed file with 4 additions and 5 deletions.
9 changes: 4 additions & 5 deletions packages/react-resizable-panels/src/Panel.ts
Original file line number Diff line number Diff line change
Expand Up @@ -54,10 +54,9 @@ export type ImperativePanelHandle = {
resize: (size: number) => void;
};

export type PanelProps = Omit<
HTMLAttributes<keyof HTMLElementTagNameMap>,
"id" | "onResize"
> &
export type PanelProps<
T extends keyof HTMLElementTagNameMap = keyof HTMLElementTagNameMap,
> = Omit<HTMLAttributes<HTMLElementTagNameMap[T]>, "id" | "onResize"> &
PropsWithChildren<{
className?: string;
collapsedSize?: number | undefined;
Expand All @@ -71,7 +70,7 @@ export type PanelProps = Omit<
onResize?: PanelOnResize;
order?: number;
style?: object;
tagName?: keyof HTMLElementTagNameMap;
tagName?: T;
}>;

export function PanelWithForwardedRef({
Expand Down

0 comments on commit c365aec

Please sign in to comment.