MCPcopy Create free account
hub / github.com/bytebase/dbhub / SidebarMenuButton

Function SidebarMenuButton

frontend/src/components/ui/sidebar.tsx:503–556  ·  view source on GitHub ↗
({
  isActive = false,
  variant = "default",
  size = "default",
  tooltip,
  className,
  render,
  ...props
}: useRender.ComponentProps<"button"> & {
  isActive?: boolean;
  tooltip?: string | React.ComponentProps<typeof TooltipPopup>;
} & VariantProps<typeof sidebarMenuButtonVariants>)

Source from the content-addressed store, hash-verified

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

Callers

nothing calls this directly

Calls 2

cnFunction · 0.90
useSidebarFunction · 0.85

Tested by

no test coverage detected