@base-ui-components/react
Version:
Base UI is a library of headless ('unstyled') React components and low-level hooks. You gain complete control over your app's CSS and accessibility features.
35 lines • 1.19 kB
TypeScript
import * as React from 'react';
export declare function useButton(parameters?: useButton.Parameters): useButton.ReturnValue;
export declare namespace useButton {
interface Parameters {
/**
* Whether the component should ignore user interaction.
* @default false
*/
disabled?: boolean;
/**
* Whether the button may receive focus even if it is disabled.
* @default false
*/
focusableWhenDisabled?: boolean;
tabIndex?: NonNullable<React.HTMLAttributes<any>['tabIndex']>;
/**
* Whether the component is being rendered as a native button.
* @default true
*/
native?: boolean;
}
interface ReturnValue {
/**
* Resolver for the button props.
* @param externalProps additional props for the button
* @returns props that should be spread on the button
*/
getButtonProps: (externalProps?: React.ComponentPropsWithRef<any>) => React.ComponentPropsWithRef<any>;
/**
* A ref to the button DOM element. This ref should be passed to the rendered element.
* It is not a part of the props returned by `getButtonProps`.
*/
buttonRef: React.RefObject<HTMLElement | null>;
}
}