MCPcopy Create free account
hub / github.com/F12FLASH/CTF / SidebarMenuButton

Function SidebarMenuButton

4.Stackless Stack/client/src/components/ui/sidebar.tsx:499–547  ·  view source on GitHub ↗
({
  asChild = false,
  isActive = false,
  variant = "default",
  size = "default",
  tooltip,
  className,
  ...props
}: React.ComponentProps<"button"> & {
  asChild?: boolean
  isActive?: boolean
  tooltip?: string | React.ComponentProps<typeof TooltipContent>
} & VariantProps<typeof sidebarMenuButtonVariants>)

Source from the content-addressed store, hash-verified

497)
498
499function SidebarMenuButton({
500 asChild = false,
501 isActive = false,
502 variant = "default",
503 size = "default",
504 tooltip,
505 className,
506 ...props
507}: React.ComponentProps<"button"> & {
508 asChild?: boolean
509 isActive?: boolean
510 tooltip?: string | React.ComponentProps<typeof TooltipContent>
511} & VariantProps<typeof sidebarMenuButtonVariants>) {
512 const Comp = asChild ? Slot : "button"
513 const { isMobile, state } = useSidebar()
514
515 const button = (
516 <Comp
517 data-slot="sidebar-menu-button"
518 data-sidebar="menu-button"
519 data-size={size}
520 data-active={isActive}
521 className={cn(sidebarMenuButtonVariants({ variant, size }), className)}
522 {...props}
523 />
524 )
525
526 if (!tooltip) {
527 return button
528 }
529
530 if (typeof tooltip === "string") {
531 tooltip = {
532 children: tooltip,
533 }
534 }
535
536 return (
537 <Tooltip>
538 <TooltipTrigger asChild>{button}</TooltipTrigger>
539 <TooltipContent
540 side="right"
541 align="center"
542 hidden={state !== "collapsed" || isMobile}
543 {...tooltip}
544 />
545 </Tooltip>
546 )
547}
548
549function SidebarMenuAction({
550 className,

Callers

nothing calls this directly

Calls 2

cnFunction · 0.90
useSidebarFunction · 0.70

Tested by

no test coverage detected