MCPcopy Create free account
hub / github.com/UsefulSoftwareCo/executor / SidebarMenuButton

Function SidebarMenuButton

packages/react/src/components/sidebar.tsx:473–521  ·  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

471);
472
473function SidebarMenuButton({
474 asChild = false,
475 isActive = false,
476 variant = "default",
477 size = "default",
478 tooltip,
479 className,
480 ...props
481}: React.ComponentProps<"button"> & {
482 asChild?: boolean;
483 isActive?: boolean;
484 tooltip?: string | React.ComponentProps<typeof TooltipContent>;
485} & VariantProps<typeof sidebarMenuButtonVariants>) {
486 const Comp = asChild ? Slot.Root : "button";
487 const { isMobile, state } = useSidebar();
488
489 const button = (
490 <Comp
491 data-slot="sidebar-menu-button"
492 data-sidebar="menu-button"
493 data-size={size}
494 data-active={isActive}
495 className={cn(sidebarMenuButtonVariants({ variant, size }), className)}
496 {...props}
497 />
498 );
499
500 if (!tooltip) {
501 return button;
502 }
503
504 if (typeof tooltip === "string") {
505 tooltip = {
506 children: tooltip,
507 };
508 }
509
510 return (
511 <Tooltip>
512 <TooltipTrigger asChild>{button}</TooltipTrigger>
513 <TooltipContent
514 side="right"
515 align="center"
516 hidden={state !== "collapsed" || isMobile}
517 {...tooltip}
518 />
519 </Tooltip>
520 );
521}
522
523function SidebarMenuAction({
524 className,

Callers

nothing calls this directly

Calls 2

cnFunction · 0.90
useSidebarFunction · 0.85

Tested by

no test coverage detected