{"id":13525095,"url":"https://github.com/lukeed/preact-scroll-header","last_synced_at":"2025-10-09T18:24:00.633Z","repository":{"id":44925940,"uuid":"83077286","full_name":"lukeed/preact-scroll-header","owner":"lukeed","description":"A (800b gzip) header that will show/hide while scrolling for Preact","archived":false,"fork":false,"pushed_at":"2018-10-25T17:27:04.000Z","size":16,"stargazers_count":42,"open_issues_count":0,"forks_count":1,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-09-17T00:39:38.998Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"https://jsfiddle.net/lukeed/cyfjsk50/","language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/lukeed.png","metadata":{"files":{"readme":"readme.md","changelog":null,"contributing":null,"funding":null,"license":"license","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2017-02-24T19:50:38.000Z","updated_at":"2025-07-05T03:28:00.000Z","dependencies_parsed_at":"2022-08-29T03:00:33.359Z","dependency_job_id":null,"html_url":"https://github.com/lukeed/preact-scroll-header","commit_stats":null,"previous_names":[],"tags_count":5,"template":false,"template_full_name":null,"purl":"pkg:github/lukeed/preact-scroll-header","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/lukeed%2Fpreact-scroll-header","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/lukeed%2Fpreact-scroll-header/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/lukeed%2Fpreact-scroll-header/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/lukeed%2Fpreact-scroll-header/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/lukeed","download_url":"https://codeload.github.com/lukeed/preact-scroll-header/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/lukeed%2Fpreact-scroll-header/sbom","scorecard":{"id":604510,"data":{"date":"2025-08-11","repo":{"name":"github.com/lukeed/preact-scroll-header","commit":"b6eab358810aa0d272d7df1ec2bae05250e24987"},"scorecard":{"version":"v5.2.1-40-gf6ed084d","commit":"f6ed084d17c9236477efd66e5b258b9d4cc7b389"},"score":3,"checks":[{"name":"Binary-Artifacts","score":10,"reason":"no binaries found in the repo","details":null,"documentation":{"short":"Determines if the project has generated executable (binary) artifacts in the source repository.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#binary-artifacts"}},{"name":"Pinned-Dependencies","score":-1,"reason":"no dependencies found","details":null,"documentation":{"short":"Determines if the project has declared and pinned the dependencies of its build process.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#pinned-dependencies"}},{"name":"Maintained","score":0,"reason":"0 commit(s) and 0 issue activity found in the last 90 days -- score normalized to 0","details":null,"documentation":{"short":"Determines if the project is \"actively maintained\".","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#maintained"}},{"name":"Packaging","score":-1,"reason":"packaging workflow not detected","details":["Warn: no GitHub/GitLab publishing workflow detected."],"documentation":{"short":"Determines if the project is published as a package that others can easily download, install, easily update, and uninstall.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#packaging"}},{"name":"SAST","score":0,"reason":"no SAST tool detected","details":["Warn: no pull requests merged into dev branch"],"documentation":{"short":"Determines if the project uses static code analysis.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#sast"}},{"name":"Code-Review","score":0,"reason":"Found 0/27 approved changesets -- score normalized to 0","details":null,"documentation":{"short":"Determines if the project requires human code review before pull requests (aka merge requests) are merged.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#code-review"}},{"name":"Token-Permissions","score":-1,"reason":"No tokens found","details":null,"documentation":{"short":"Determines if the project's workflows follow the principle of least privilege.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#token-permissions"}},{"name":"Dangerous-Workflow","score":-1,"reason":"no workflows found","details":null,"documentation":{"short":"Determines if the project's GitHub Action workflows avoid dangerous patterns.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#dangerous-workflow"}},{"name":"CII-Best-Practices","score":0,"reason":"no effort to earn an OpenSSF best practices badge detected","details":null,"documentation":{"short":"Determines if the project has an OpenSSF (formerly CII) Best Practices Badge.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#cii-best-practices"}},{"name":"Security-Policy","score":0,"reason":"security policy file not detected","details":["Warn: no security policy file detected","Warn: no security file to analyze","Warn: no security file to analyze","Warn: no security file to analyze"],"documentation":{"short":"Determines if the project has published a security policy.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#security-policy"}},{"name":"Fuzzing","score":0,"reason":"project is not fuzzed","details":["Warn: no fuzzer integrations found"],"documentation":{"short":"Determines if the project uses fuzzing.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#fuzzing"}},{"name":"Vulnerabilities","score":10,"reason":"0 existing vulnerabilities detected","details":null,"documentation":{"short":"Determines if the project has open, known unfixed vulnerabilities.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#vulnerabilities"}},{"name":"License","score":10,"reason":"license file detected","details":["Info: project has a license file: license:0","Info: FSF or OSI recognized license: MIT License: license:0"],"documentation":{"short":"Determines if the project has defined a license.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#license"}},{"name":"Signed-Releases","score":-1,"reason":"no releases found","details":null,"documentation":{"short":"Determines if the project cryptographically signs release artifacts.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#signed-releases"}},{"name":"Branch-Protection","score":0,"reason":"branch protection not enabled on development/release branches","details":["Warn: branch protection not enabled for branch 'master'"],"documentation":{"short":"Determines if the default and release branches are protected with GitHub's branch protection settings.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#branch-protection"}}]},"last_synced_at":"2025-08-21T01:16:10.912Z","repository_id":44925940,"created_at":"2025-08-21T01:16:10.912Z","updated_at":"2025-08-21T01:16:10.912Z"},"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":279001940,"owners_count":26083226,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","status":"online","status_checked_at":"2025-10-09T02:00:07.460Z","response_time":59,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-08-01T06:01:15.897Z","updated_at":"2025-10-09T18:24:00.584Z","avatar_url":"https://github.com/lukeed.png","language":"JavaScript","funding_links":[],"categories":["Uncategorized"],"sub_categories":["Uncategorized"],"readme":"# preact-scroll-header [![NPM](https://img.shields.io/npm/v/preact-scroll-header.svg)](https://www.npmjs.com/package/preact-scroll-header)\n\n\u003e A (800b gzip) header that will show/hide while scrolling; for :atom_symbol: [Preact](https://github.com/developit/preact)\n\n#### [Demo (standard)](https://jsfiddle.net/lukeed/cyfjsk50/)\n\n#### [Demo (inverse)](https://jsfiddle.net/lukeed/mxrse9k4/)\n\n## Install\n\n```\n$ npm install --save preact-scroll-header\n```\n\n\u003e :exclamation: **Pro Tip:** Use [Yarn](https://yarnpkg.com/) to install dependencies 3x faster than NPM!\n\n```html\n\u003cscript src=\"https://unpkg.com/preact-scroll-header@1.0.0/dist/preact-scroll-header.min.js\"\u003e\u003c/script\u003e\n```\n\n## Usage\n\nProvide a `value`; everything else is optional.\n\n```js\nimport { h } from 'preact';\nimport ScrollHeader from 'preact-scroll-header';\n\n\u003cScrollHeader\n  id=\"header\" className=\"menu\"\n  buffer={ 24 } showClass=\"menu-show\"\n  onShow={ el =\u003e console.log('SHOWN', el) }\n  onHide={ el =\u003e console.log('HIDDEN', el) }\u003e\n  \u003ch1\u003eMenu\u003c/h1\u003e\n\u003c/ScrollHeader\u003e\n```\n\n## Styles\n\nThis component does not include any inline styles. Instead, classnames are assigned for every state the `\u003cScrollHeader/\u003e` enters. This provides greater flexibility and control of your desired effects! \n\nHowever, there are some strong guidelines which you should not neglect. Below is an example for a simple slide-down effect:\n\n```css\n/* start with \"shown\" position */\n/* will-change, top, right, left early to avoid extra repaints */\n.header {\n  position: relative;\n  will-change: transform;\n  transform: translateY(0%);\n  right: 0;\n  left: 0;\n  top: 0;\n}\n\n/* apply fixed; set start point */\n.is--fixed {\n  position: fixed;\n  transform: translateY(-100%);\n}\n\n/* apply transition separately; no flicker */\n.is--ready {\n  transition: transform 0.2s ease-in-out;\n}\n\n/* set end point; with shadow */\n.is--shown {\n  transform: translateY(0%);\n  box-shadow: 0 3px 6px rgba(0,0,0, 0.16);\n}\n```\n\n\u003e **Note:** Assumes that \"header\" was added as your base `className`. All others are defaults.\n\n\n## Properties\n\n#### id\nType: `String`\u003cbr\u003e\nDefault: `none`\n\nThe `id` attribute to pass down.\n\n#### className\nType: `String`\u003cbr\u003e\nDefault: `none`\n\nThe `className` attribute to pass down. Added to the wrapper element.\n\n#### fixClass\nType: `String`\u003cbr\u003e\nDefault: `'is--fixed'`\n\nThe `className` to add when the header is out of view. This should apply a `position:fixed` style, as well as an initial `transform` value.\n\n#### readyClass\nType: `String`\u003cbr\u003e\nDefault: `'is--ready'`\n\nThe `className` to add when the header has been \"fixed\". This should apply a `transition` value to your header, which should always be separated from your [`fixClass`](#fixClass).\n\n\u003e **Note:** Applying a `transition` _before_ this class (via base style or `fixClass`) will cause the `\u003cScrollHeader/\u003e` to flicker into view before hiding.\n\n#### showClass\nType: `String`\u003cbr\u003e\nDefault: `'is--shown'`\n\nThe `className` to add when the header should be revealed. This should apply your desired `transform` effect. Class is only applied when the `\u003cScrollHeader/\u003e` is out of view and has been \"fixed\".\n\n#### buffer\nType: `Number`\u003cbr\u003e\nDefault: `0`\n\nThe number of pixels to scroll before applying your [`showClass`](#showClass). By default, the `\u003cScrollHeader/\u003e` will be shown immediately after user scrolls up.\n\n#### listenTo\nType: `String`\u003cbr\u003e\nDefault: `this.base.parentNode`\n\nThe \"scroller\" element that will fire `scroll` events. Works well with customized viewports, where `document.body` is not scrollable and/or controlling overflow.\n\n#### disabled\nType: `Boolean`\u003cbr\u003e\nDefault: `false`\n\nWhether or not to disable the show/hide behavior. If `true`, **will not** add `fixClass`, `readyClass`, or `showClass`.\n\n#### onShow\nType: `Function`\n\nThe callback function when the header is to be shown. Receivies the DOM element as its only argument, but is bound to the `ScrollHeader` component context.\n\n#### onHide\nType: `Function`\n\nThe callback function when the header is to be hidden. Receivies the DOM element as its only argument, but is bound to the `ScrollHeader` component context.\n\n\n## License\n\nMIT © [Luke Edwards](https://lukeed.com)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Flukeed%2Fpreact-scroll-header","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Flukeed%2Fpreact-scroll-header","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Flukeed%2Fpreact-scroll-header/lists"}