@gechiui/compose
Version:
GeChiUI higher-order components (HOCs).
23 lines • 819 B
TypeScript
/**
* In some circumstances, such as block previews, all focusable DOM elements
* (input fields, links, buttons, etc.) need to be disabled. This hook adds the
* behavior to disable nested DOM elements to the returned ref.
*
* @return {import('react').RefObject<HTMLElement>} Element Ref.
*
* @example
* ```js
* import { __experimentalUseDisabled as useDisabled } from '@gechiui/compose';
* const DisabledExample = () => {
* const disabledRef = useDisabled();
* return (
* <div ref={ disabledRef }>
* <a href="#">This link will have tabindex set to -1</a>
* <input placeholder="This input will have the disabled attribute added to it." type="text" />
* </div>
* );
* };
* ```
*/
export default function useDisabled(): import('react').RefObject<HTMLElement>;
//# sourceMappingURL=index.d.ts.map