@itwin/itwinui-react
Version:
A react component library for iTwinUI
33 lines (32 loc) • 1.37 kB
TypeScript
import * as React from 'react';
import type { ButtonProps } from './Button.js';
import { DropdownMenu } from '../DropdownMenu/DropdownMenu.js';
import type { PolymorphicForwardRefComponent } from '../../utils/index.js';
export type DropdownButtonProps = {
/**
* Items in the dropdown menu.
* Pass a function that takes the `close` argument (to close the menu),
* and returns a list of `MenuItem` components.
*/
menuItems: ((close: () => void) => React.JSX.Element[]) | React.JSX.Element[] | React.JSX.Element;
/**
* Style of the dropdown button.
* Use 'borderless' to hide outline.
* @default 'default'
*/
styleType?: 'default' | 'borderless' | 'high-visibility';
/**
* Props for the `DropdownMenu` which extends the props of `Popover`.
*/
dropdownMenuProps?: Omit<React.ComponentProps<typeof DropdownMenu>, 'menuItems' | 'children'>;
} & Omit<ButtonProps, 'styleType' | 'endIcon'>;
/**
* Button that opens a DropdownMenu.
* @example
* const menuItems = (close: () => void) => [
* <MenuItem key={1} onClick={onClick(1, close)}>Item #1</MenuItem>,
* <MenuItem key={2} onClick={onClick(2, close)}>Item #2</MenuItem>,
* ];
* <DropdownButton menuItems={menuItems}>Default</DropdownButton>
*/
export declare const DropdownButton: PolymorphicForwardRefComponent<"button", DropdownButtonProps>;