UNPKG

1.43 kBTypeScriptView Raw
1/// <reference types="react" />
2export interface UseMenuButtonParameters {
3 /**
4 * If `true`, the component is disabled.
5 * @default false
6 */
7 disabled?: boolean;
8 /**
9 * If `true`, allows a disabled button to receive focus.
10 * @default false
11 */
12 focusableWhenDisabled?: boolean;
13 /**
14 * The ref to the root element.
15 */
16 rootRef?: React.Ref<HTMLElement>;
17}
18type UseMenuButtonRootSlotProps<ExternalProps = {}> = ExternalProps & UseMenuButtonRootSlotOwnProps;
19interface UseMenuButtonRootSlotOwnProps {
20 'aria-haspopup': 'menu';
21 'aria-expanded': boolean;
22 'aria-controls': string;
23 /**
24 * Callback fired when the button is clicked.
25 */
26 onClick: React.MouseEventHandler;
27 /**
28 * The ref to the button element.
29 */
30 ref: React.RefCallback<Element> | null;
31}
32export interface UseMenuButtonReturnValue {
33 /**
34 * If `true`, the component is active (pressed).
35 */
36 active: boolean;
37 /**
38 * Resolver for the root slot's props.
39 * @param externalProps props for the root slot
40 * @returns props that should be spread on the root slot
41 */
42 getRootProps: <ExternalProps extends Record<string, unknown> = {}>(externalProps?: ExternalProps) => UseMenuButtonRootSlotProps<ExternalProps>;
43 open: boolean;
44 /**
45 * The ref to the root element.
46 */
47 rootRef: React.RefCallback<Element> | null;
48}
49export {};