@@ -253,15 +253,15 @@ function Sidebar({
253253 )
254254}
255255
256- function SidebarTrigger ( {
257- className,
258- onClick,
259- ...props
260- } : React . ComponentProps < typeof Button > ) {
256+ const SidebarTrigger = React . forwardRef <
257+ HTMLButtonElement ,
258+ React . ComponentProps < typeof Button >
259+ > ( ( { className, onClick, ...props } , ref ) => {
261260 const { toggleSidebar } = useSidebar ( )
262261
263262 return (
264263 < Button
264+ ref = { ref }
265265 data-sidebar = "trigger"
266266 data-slot = "sidebar-trigger"
267267 variant = "ghost"
@@ -277,7 +277,8 @@ function SidebarTrigger({
277277 < span className = "sr-only" > Toggle Sidebar</ span >
278278 </ Button >
279279 )
280- }
280+ } )
281+ SidebarTrigger . displayName = "SidebarTrigger"
281282
282283function SidebarRail ( { className, ...props } : React . ComponentProps < "button" > ) {
283284 const { toggleSidebar } = useSidebar ( )
@@ -495,24 +496,28 @@ const sidebarMenuButtonVariants = cva(
495496 }
496497)
497498
498- function SidebarMenuButton ( {
499+ const SidebarMenuButton = React . forwardRef <
500+ HTMLButtonElement ,
501+ React . ComponentProps < "button" > & {
502+ asChild ?: boolean
503+ isActive ?: boolean
504+ tooltip ?: string | React . ComponentProps < typeof TooltipContent >
505+ } & VariantProps < typeof sidebarMenuButtonVariants >
506+ > ( ( {
499507 asChild = false ,
500508 isActive = false ,
501509 variant = "default" ,
502510 size = "default" ,
503511 tooltip,
504512 className,
505513 ...props
506- } : React . ComponentProps < "button" > & {
507- asChild ?: boolean
508- isActive ?: boolean
509- tooltip ?: string | React . ComponentProps < typeof TooltipContent >
510- } & VariantProps < typeof sidebarMenuButtonVariants > ) {
514+ } , ref ) => {
511515 const Comp = asChild ? Slot : "button"
512516 const { isMobile, state } = useSidebar ( )
513517
514518 const button = (
515519 < Comp
520+ ref = { ref }
516521 data-slot = "sidebar-menu-button"
517522 data-sidebar = "menu-button"
518523 data-size = { size }
@@ -543,7 +548,8 @@ function SidebarMenuButton({
543548 />
544549 </ Tooltip >
545550 )
546- }
551+ } )
552+ SidebarMenuButton . displayName = "SidebarMenuButton"
547553
548554function SidebarMenuAction ( {
549555 className,
0 commit comments