UNPKG

@carbon/react

Version:

React components for the Carbon Design System

116 lines (115 loc) 3.4 kB
/** * Copyright IBM Corp. 2016, 2025 * * This source code is licensed under the Apache-2.0 license found in the * LICENSE file in the root directory of this source tree. */ import React, { type ElementType, type ReactNode, type Ref } from 'react'; import { type MenuDirection, type MenuOffset } from '../../internal/FloatingMenu'; import { IconButtonProps } from '../IconButton'; /** * Calculates the offset for the floating menu. * * @param menuBody - The menu body with the menu arrow. * @param direction - The floating menu direction. * @returns The adjustment of the floating menu position, upon the position of * the menu arrow. */ export declare const getMenuOffset: MenuOffset; export interface OverflowMenuProps extends Omit<IconButtonProps, 'type' | 'aria-haspopup' | 'aria-expanded' | 'aria-controls' | 'className' | 'onClick' | 'id' | 'ref' | 'size' | 'label' | 'kind'> { /** * Specify a label to be read by screen readers on the container node */ ['aria-label']?: string; /** * Specify a label to be read by screen readers on the container note. * * @deprecated - Use `aria-label` instead. */ ariaLabel?: string; /** * The child nodes. */ children: ReactNode; /** * The CSS class names. */ className?: string; /** * The menu direction. */ direction?: MenuDirection; /** * `true` if the menu alignment should be flipped. */ flipped?: boolean; /** * Enable or disable focus trap behavior */ focusTrap?: boolean; /** * The CSS class for the icon. */ iconClass?: string; /** * The element ID. */ id?: string; /** * The icon description. */ iconDescription?: string; /** * `true` to use the light version. For use on $ui-01 backgrounds only. * Don't use this to make OverflowMenu background color same as container background color. */ light?: boolean; /** * The adjustment in position applied to the floating menu. */ menuOffset?: MenuOffset; /** * The adjustment in position applied to the floating menu. */ menuOffsetFlip?: MenuOffset; /** * The class to apply to the menu options */ menuOptionsClass?: string; /** * The event handler for the `click` event. */ onClick?: (evt?: any) => void; /** * Function called when menu is closed */ onClose?: () => void; /** * Function called when menu is opened */ onOpen?: () => void; /** * `true` if the menu should be open. */ open?: boolean; /** * A component used to render an icon. */ renderIcon?: ElementType; /** * Specify a CSS selector that matches the DOM element that should * be focused when the OverflowMenu opens */ selectorPrimaryFocus?: string; /** * Specify the size of the OverflowMenu. Currently supports either `sm`, `md` (default) or `lg` as an option. */ size?: 'sm' | 'md' | 'lg'; /** * The ref to the overflow menu's trigger button element. * @deprecated Use the standard React `ref` prop instead. */ innerRef?: Ref<any>; } export declare const OverflowMenu: React.ForwardRefExoticComponent<OverflowMenuProps & React.RefAttributes<HTMLButtonElement>>; export default OverflowMenu;