UNPKG

raw3d-ui

Version:

A 3D UI component library built for the Log It Raw community, starting with a mechanical keycap button.

40 lines (39 loc) 1.26 kB
import { type SoundConfig } from '../context/SoundContextTypes'; /** * Custom hook for easy sound integration in components * @returns {Object} Object containing sound utilities * @returns {Function} returns.playSound - Function to play a sound with config * @returns {Function} returns.playClick - Function to play a click sound * @returns {Function} returns.playHover - Function to play a hover sound * @returns {Function} returns.playSuccess - Function to play a success sound * @returns {Function} returns.playError - Function to play an error sound * @returns {boolean} returns.soundOn - Whether sound is enabled * @returns {Function} returns.toggleSound - Function to toggle sound on/off * * @example * ```tsx * import { useSound } from 'raw3d-ui'; * * function MyComponent() { * const { playClick, playHover } = useSound(); * * return ( * <button * onClick={playClick} * onMouseEnter={playHover} * > * Click me! * </button> * ); * } * ``` */ export declare const useSound: () => { soundOn: boolean; toggleSound: () => void; playClick: () => void; playHover: () => void; playSuccess: () => void; playError: () => void; playCustom: (config: SoundConfig) => void; };