UNPKG

@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.

41 lines (40 loc) 1.42 kB
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; buttonRef?: React.Ref<Element>; tabIndex?: NonNullable<React.HTMLAttributes<any>['tabIndex']>; /** * Type attribute applied when the `component` is `button`. * @default 'button' */ type?: React.ButtonHTMLAttributes<HTMLButtonElement>['type']; /** * The HTML element, e.g.'button', 'span' etc. * @default '' */ elementName?: keyof HTMLElementTagNameMap; } 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. */ buttonRef: React.RefCallback<Element> | null; } }