MCPcopy Create free account
hub / github.com/Kilo-Org/cloud / SidebarMenuButton

Function SidebarMenuButton

apps/web/src/components/ui/sidebar.tsx:476–524  ·  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

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

Callers

nothing calls this directly

Calls 2

cnFunction · 0.90
useSidebarFunction · 0.85

Tested by

no test coverage detected