{"_id":"@27-lanterns/use-toggle","name":"@27-lanterns/use-toggle","dist-tags":{"latest":"1.0.0"},"versions":{"1.0.0":{"name":"@27-lanterns/use-toggle","version":"1.0.0","description":"A custom React hook for toggling states","author":{"name":"Evgenii Astapushkin","email":"lebannehn.karnimirie@gmail.com"},"keywords":["hooks","react","toggle","state"],"bugs":{"url":"https://github.com/lebannehn/use-toggle/issues"},"homepage":"https://github.com/lebannehn/use-toggle","repository":{"type":"git","url":"git+https://github.com/lebannehn/use-toggle.git"},"license":"MIT","type":"commonjs","main":"package/index.js","scripts":{"gulp:build":"npx gulp build"},"peerDependencies":{"react":">=16.8.0"},"devDependencies":{"typescript":">=4.1.6","@types/react":">=16.8.0","@types/gulp":"^4.0.17","del":"^8.0.0","gulp":"^5.0.1","gulp-typescript":"^6.0.0-alpha.1","through2":"^4.0.2"},"engines":{"node":">=8.16.0"},"publishConfig":{"access":"public"},"_id":"@27-lanterns/use-toggle@1.0.0","types":"./package/index.d.ts","_nodeVersion":"18.20.8","_npmVersion":"10.8.2","dist":{"integrity":"sha512-mwbH948hNY99PgFAr9XEIC04NfwycG3E/I8VYp5KI5i5YL96/yfhhr4IDG/qdJpkwUyCK6pHg/mohlqeKl14WA==","shasum":"18e056d8b618ed5f648c6ecacd80eedffddbfa9f","tarball":"https://registry.npmjs.org/@27-lanterns/use-toggle/-/use-toggle-1.0.0.tgz","fileCount":5,"unpackedSize":4543,"signatures":[{"keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U","sig":"MEYCIQDSoEiLdVbbk56izfE+yzEWbMGWWzlStCp+wnEMZXyAtAIhAJb72G/Sv9ki/kgDxcaRRUvF8su0mRNXRCcaYmLy0+JS"}]},"_npmUser":{"name":"lebannehn","email":"lebannehn.karnimirie@gmail.com"},"directories":{},"maintainers":[{"name":"lebannehn","email":"lebannehn.karnimirie@gmail.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages-npm-production","tmp":"tmp/use-toggle_1.0.0_1758576531388_0.9247001075942836"},"_hasShrinkwrap":false}},"time":{"created":"2025-09-22T21:28:51.329Z","1.0.0":"2025-09-22T21:28:51.606Z","modified":"2025-09-22T21:28:51.849Z"},"maintainers":[{"name":"lebannehn","email":"lebannehn.karnimirie@gmail.com"}],"description":"A custom React hook for toggling states","homepage":"https://github.com/lebannehn/use-toggle","keywords":["hooks","react","toggle","state"],"repository":{"type":"git","url":"git+https://github.com/lebannehn/use-toggle.git"},"author":{"name":"Evgenii Astapushkin","email":"lebannehn.karnimirie@gmail.com"},"bugs":{"url":"https://github.com/lebannehn/use-toggle/issues"},"license":"MIT","readme":"# use-toggle\n\nA custom [React](https://react.dev) hook to toggle states.\n\n### Installation\n\n```console\nnpm i @27-lanterns/use-toggle\n```\n\n### Params\n\n| Param          | type              | Optional? | Default value        | Description       |\n|----------------|-------------------|--------|----------------------|-------------------|\n| initialValue   | `T`               | Yes    | `false`              | An initial value  |\n| toggleFunction | `(value: T) => T` | Yes       | `(v: boolean) => !v` | Toggling function |\n\n### Usage\n\n```tsx\nimport React, { FC } from 'react';\nimport { useToggle } from '@27-lanterns/use-toggle';\n\nconst SomeWizardComponent: FC = () => {\n\tconst [boolValue, toggleBoolValue] = useToggle();\n\treturn <>\n        <span>Is enabled? {boolValue ? 'Yes' : 'No'}</span>\n        <button onClick={toggleBoolValue}>Toggle</button>\n    </>;\n};\n\nconst togglingFunction = (value: string) => value === 'enabled' ? 'disabled' : 'enabled';\n\nconst SomeOtherComponent: FC = () => {\n\tconst [value, toggleValue] = useToggle('disabled', togglingFunction);\n\t\n\treturn <>\n\t\t<span>{value}</span>\n\t\t<button onClick={toggleValue}>Toggle</button>\n\t</>;\n};\n```\n","readmeFilename":"README.md","_rev":"1-531efbd89ef8fe7379f64a15999b19fc"}