Salta ai contenuti

MenubarItemIndicator

Questi contenuti non sono ancora disponibili nella tua lingua.

import { MenubarItemIndicator } from "@rebasepro/ui";
Prop Type Required Description
children React.ReactNode
className string

This is the example the design-system sync renders and verifies for this component.

import React from "react";
import {
Menubar,
MenubarMenu,
MenubarTrigger,
MenubarPortal,
MenubarContent,
MenubarCheckboxItem,
MenubarItemIndicator
} from "@rebasepro/ui";
function useOpenMenu(ref: React.RefObject<HTMLDivElement>, triggerIndex: number) {
React.useEffect(() => {
const trigger = ref.current?.querySelectorAll('button[aria-haspopup="menu"]')[triggerIndex] as HTMLElement | undefined;
trigger?.dispatchEvent(new PointerEvent("pointerdown", { bubbles: true, cancelable: true, button: 0 }));
}, [ref, triggerIndex]);
}
// The check mark rendered by a checked checkbox item.
export const OnCheckboxItem = () => {
const ref = React.useRef<HTMLDivElement>(null);
useOpenMenu(ref, 0);
return (
<div ref={ref} className="p-4 h-[220px]">
<Menubar>
<MenubarMenu>
<MenubarTrigger>View</MenubarTrigger>
<MenubarPortal>
<MenubarContent>
<MenubarCheckboxItem checked onCheckedChange={() => {}}>
<MenubarItemIndicator/>
Table editor
</MenubarCheckboxItem>
<MenubarCheckboxItem checked={false} onCheckedChange={() => {}}>
<MenubarItemIndicator/>
Query logs
</MenubarCheckboxItem>
</MenubarContent>
</MenubarPortal>
</MenubarMenu>
</Menubar>
</div>
);
};