MCPcopy
hub / github.com/TheOrcDev/8bitcn-ui / SidebarMenuButton

Function SidebarMenuButton

components/ui/sidebar.tsx:503–551  ·  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

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

Callers

nothing calls this directly

Calls 2

cnFunction · 0.90
useSidebarFunction · 0.85

Tested by

no test coverage detected