UNPKG

@tanstack/react-hotkeys

Version:

React adapter for TanStack Hotkeys

27 lines • 873 B
import { formatForDisplay } from "@tanstack/hotkeys"; //#region src/useFormatForDisplay.d.ts /** * Returns `formatForDisplay` with the platform from `HotkeysProvider`, or the * detected platform without one. A `platform` passed to the returned function * wins. * * Call the hook once at the top of the component; the returned function can * be called anywhere, such as in a loop or a condition. Server-rendered apps * should set the provider's `defaultOptions.platform` from the request with * `detectPlatform(userAgent)`, so the server HTML matches the user's platform. * * @example * ```tsx * function SaveButton() { * const format = useFormatForDisplay() * * return ( * <button> * Save <kbd>{format('Mod+S')}</kbd> * </button> * ) * } * ``` */ export declare function useFormatForDisplay(): typeof formatForDisplay; //#endregion