diff --git a/src/components/common/PlatformIconButton.tsx b/src/components/common/PlatformIconButton.tsx index 2f567136..4cf90c7f 100644 --- a/src/components/common/PlatformIconButton.tsx +++ b/src/components/common/PlatformIconButton.tsx @@ -1,9 +1,11 @@ +import { forwardRef } from 'react'; import type { ButtonHTMLAttributes, HTMLAttributes, KeyboardEvent, LabelHTMLAttributes, ReactNode, + Ref, } from 'react'; type PlatformIconButtonBaseProps = { @@ -52,16 +54,22 @@ type PlatformIconButtonProps = * 平台通用图标动作按钮。 * 统一承接纯图标动作、图标上传 label 和带短标签的浮动图标动作。 */ -export function PlatformIconButton({ - label, - icon, - children, - variant = 'platformIcon', - title, - className, - asChild, - ...actionProps -}: PlatformIconButtonProps) { +export const PlatformIconButton = forwardRef< + HTMLButtonElement | HTMLLabelElement | HTMLSpanElement, + PlatformIconButtonProps +>(function PlatformIconButton( + { + label, + icon, + children, + variant = 'platformIcon', + title, + className, + asChild, + ...actionProps + }, + ref, +) { const variantClassName = { platformIcon: 'platform-icon-button', surfaceFloating: @@ -78,6 +86,7 @@ export function PlatformIconButton({ return (