UNPKG

carbon-react

Version:

A library of reusable React components for easily building user interfaces.

48 lines (47 loc) 1.87 kB
import React from "react"; import { MarginProps } from "styled-system"; import { TagProps } from "../../__internal__/utils/helpers/tags"; import { Alignment } from "./__internal__/action-popover.context"; export interface RenderButtonProps { tabIndex: number; "data-element": string; ariaAttributes: { "aria-haspopup": string; "aria-label"?: string; "aria-labelledby"?: string; "aria-describedby"?: string; "aria-controls": string; "aria-expanded": string; }; } export interface ActionPopoverProps extends MarginProps, TagProps { /** Children for popover component */ children?: React.ReactNode; /** Horizontal alignment of menu items content */ horizontalAlignment?: Alignment; /** Sets submenu position */ submenuPosition?: Alignment; /** Unique ID */ id?: string; /** Callback to be called on menu open */ onOpen?: () => void; /** Callback to be called on menu close */ onClose?: () => void; /** Set whether the menu should open above or below the button */ placement?: "bottom" | "top"; /** Render a custom menu button to override default ellipsis icon */ renderButton?: (buttonProps: RenderButtonProps) => React.ReactNode; /** Boolean to control whether menu should align to right */ rightAlignMenu?: boolean; /** Prop to specify an aria-label for the component */ "aria-label"?: string; /** Prop to specify an aria-labelledby for the component */ "aria-labelledby"?: string; /** Prop to specify an aria-describedby for the component */ "aria-describedby"?: string; } export type ActionPopoverHandle = { focusButton: () => void; } | null; export declare const ActionPopover: React.ForwardRefExoticComponent<ActionPopoverProps & React.RefAttributes<ActionPopoverHandle>>; export default ActionPopover;