From 32c1a26dcb02d6c564b32fbd03a9a0ac716bf582 Mon Sep 17 00:00:00 2001 From: softmarshmallow Date: Tue, 7 Nov 2023 13:32:45 +0900 Subject: [PATCH] add forward ref --- packages/console-ui/button/index.tsx | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/packages/console-ui/button/index.tsx b/packages/console-ui/button/index.tsx index 21052a5..53c843e 100644 --- a/packages/console-ui/button/index.tsx +++ b/packages/console-ui/button/index.tsx @@ -14,7 +14,7 @@ const bgcolormap = { red: "red", }; -export function Button({ +export const Button = React.forwardRef(function Button({ onClick, color = "black", width = "auto", @@ -27,9 +27,10 @@ export function Button({ disabled?: boolean; width?: React.CSSProperties["width"]; height?: React.CSSProperties["height"]; -} & React.PropsWithChildren) { +} & React.PropsWithChildren, forwaredRef: React.Ref) { return ( ); -} +}) const ButtonBase = styled.button<{ textColor: CSSProperties["color"];