{"id":18496226,"url":"https://github.com/oddbird/show-when","last_synced_at":"2025-04-08T22:32:07.159Z","repository":{"id":216391204,"uuid":"741207330","full_name":"oddbird/show-when","owner":"oddbird","description":"An element that shows or hides based on provided conditions","archived":false,"fork":false,"pushed_at":"2024-02-13T16:51:37.000Z","size":34,"stargazers_count":22,"open_issues_count":4,"forks_count":2,"subscribers_count":4,"default_branch":"main","last_synced_at":"2024-10-29T18:48:53.451Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"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/oddbird.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,"governance":null,"roadmap":null,"authors":null,"dei":null},"funding":{"github":"oddbird","open_collective":"oddbird-open-source"}},"created_at":"2024-01-09T23:14:36.000Z","updated_at":"2024-04-12T11:06:12.000Z","dependencies_parsed_at":"2024-01-12T00:35:37.377Z","dependency_job_id":"af47d586-124e-48f7-bcd2-dafb34b54469","html_url":"https://github.com/oddbird/show-when","commit_stats":{"total_commits":14,"total_committers":3,"mean_commits":4.666666666666667,"dds":0.2857142857142857,"last_synced_commit":"c130f94262b1153ba8f6eb823e8ee2e4a703850d"},"previous_names":["oddbird/only-show","oddbird/show-when"],"tags_count":0,"template":false,"template_full_name":"daviddarnes/component-template","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/oddbird%2Fshow-when","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/oddbird%2Fshow-when/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/oddbird%2Fshow-when/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/oddbird%2Fshow-when/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/oddbird","download_url":"https://codeload.github.com/oddbird/show-when/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247929829,"owners_count":21019950,"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","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-11-06T13:28:32.752Z","updated_at":"2025-04-08T22:32:07.135Z","avatar_url":"https://github.com/oddbird.png","language":"JavaScript","funding_links":["https://github.com/sponsors/oddbird","https://opencollective.com/oddbird-open-source"],"categories":[],"sub_categories":[],"readme":"# `show-when`\n\nA Web Component\nfor showing or hiding content\nwhen given conditions are met.\n\n**[Demo](https://oddbird.github.io/show-when/demo.html)**\n\n## Examples\n\nGeneral usage example:\n\n```html\n\u003cscript type=\"module\" src=\"show-when.js\"\u003e\u003c/script\u003e\n\n\u003cshow-when has-param=\"edit\"\u003e\n  This will be visible by default,\n  but will hide\n  if the current url\n  does not have\n  the `edit` query parameter attached.\n\u003c/show-when\u003e\n\n\u003cshow-when has-support=\"container-name: any\" hidden\u003e\n  This will be hidden by default,\n  but show up in browsers\n  that support container queries.\n\u003c/show-when\u003e\n```\n\nExample using `has-any` option:\n\n```html\n\u003cscript type=\"module\" src=\"show-when.js\"\u003e\u003c/script\u003e\n\n\u003cshow-when has-hash=\"slide-2\" has-param=\"show_all\" has-any\u003e\n  This will be visible\n  if either the hash or query parameter\n  is present in the URL\n\u003c/show-when\u003e\n```\n\n## ToDo\n\n- Add support for container queries\n\n## Installation\n\nYou have a few options (choose one of these):\n\n1. Install via [npm](https://www.npmjs.com/package/@oddbird/show-when): `npm install @oddbird/show-when`\n1. [Download the source manually from GitHub](https://github.com/oddbird/show-when/releases) into your project.\n1. Skip this step and use the script directly via a 3rd party CDN (not recommended for production use)\n\n### Usage\n\nMake sure you include the `\u003cscript\u003e` in your project (choose one of these):\n\n```html\n\u003c!-- Host yourself --\u003e\n\u003cscript type=\"module\" src=\"show-when.js\"\u003e\u003c/script\u003e\n```\n\n```html\n\u003c!-- 3rd party CDN, not recommended for production use --\u003e\n\u003cscript\n  type=\"module\"\n  src=\"https://www.unpkg.com/@oddbird/show-when/show-when.js\"\n\u003e\u003c/script\u003e\n```\n\n```html\n\u003c!-- 3rd party CDN, not recommended for production use --\u003e\n\u003cscript\n  type=\"module\"\n  src=\"https://esm.sh/@oddbird/show-when\"\n\u003e\u003c/script\u003e\n```\n\n## Credit\n\nWith thanks to the following people:\n\n- David Darnes for the [Component Template](https://github.com/daviddarnes/component-template).\n\n## Support\n\nAt OddBird,\nwe enjoy collaborating and contributing\nas part of an open web community.\nBut those contributions take time and effort.\nIf you're interested in supporting our\nopen-source work,\nconsider becoming a\n[GitHub sponsor](https://github.com/sponsors/oddbird),\nor contributing to our\n[Open Collective](https://opencollective.com/oddbird-open-source).\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Foddbird%2Fshow-when","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Foddbird%2Fshow-when","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Foddbird%2Fshow-when/lists"}