bknd
Version:
Lightweight Firebase/Supabase alternative built to run anywhere — incl. Next.js, React Router, Astro, Cloudflare, Bun, Node, AWS Lambda & more.
32 lines (31 loc) • 1.3 kB
TypeScript
import { type ComponentPropsWithoutRef, type ReactElement, type ReactNode } from "react";
export type DropdownItem = (() => ReactNode) | {
label: string | ReactElement;
icon?: any;
onClick?: () => void;
destructive?: boolean;
disabled?: boolean;
title?: string;
[key: string]: any;
};
export type DropdownClickableChild = ReactElement<{
onClick: () => void;
}>;
export type DropdownProps = {
className?: string;
openEvent?: "onClick" | "onContextMenu";
defaultOpen?: boolean;
title?: string | ReactElement;
dropdownWrapperProps?: Omit<ComponentPropsWithoutRef<"div">, "style">;
position?: "bottom-start" | "bottom-end" | "top-start" | "top-end";
hideOnEmpty?: boolean;
items: (DropdownItem | undefined | boolean)[];
itemsClassName?: string;
children: DropdownClickableChild;
onClickItem?: (item: DropdownItem) => void;
renderItem?: (item: DropdownItem, props: {
key: number;
onClick: (e: any) => void;
}) => DropdownClickableChild;
};
export declare function Dropdown({ children, defaultOpen, openEvent, position: initialPosition, dropdownWrapperProps, items, title, hideOnEmpty, onClickItem, renderItem, itemsClassName, className, }: DropdownProps): import("react/jsx-runtime").JSX.Element | null;