{"id":13638742,"url":"https://github.com/oom-components/tab","last_synced_at":"2025-04-12T03:25:36.297Z","repository":{"id":57133323,"uuid":"148635591","full_name":"oom-components/tab","owner":"oom-components","description":"Yet another tab panel component","archived":false,"fork":false,"pushed_at":"2024-02-14T14:49:17.000Z","size":24,"stargazers_count":3,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-04-09T10:50:14.442Z","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/oom-components.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","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,"publiccode":null,"codemeta":null}},"created_at":"2018-09-13T12:39:23.000Z","updated_at":"2024-12-02T23:22:55.000Z","dependencies_parsed_at":"2024-01-14T11:00:50.597Z","dependency_job_id":"218290ee-967f-45f6-a457-591ad598a967","html_url":"https://github.com/oom-components/tab","commit_stats":null,"previous_names":[],"tags_count":4,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/oom-components%2Ftab","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/oom-components%2Ftab/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/oom-components%2Ftab/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/oom-components%2Ftab/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/oom-components","download_url":"https://codeload.github.com/oom-components/tab/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248511252,"owners_count":21116375,"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-08-02T01:00:52.768Z","updated_at":"2025-04-12T03:25:36.274Z","avatar_url":"https://github.com/oom-components.png","language":"JavaScript","readme":"# @oom/tab\n\nTab panel component with the following features:\n\n- No dependencies\n- Light: Aprox 200 lines of code (including comments and spaces)\n- Follows the **progressive enhancement strategy:**\n  - Works with just `html`\n  - Works better with `html` and `css`\n  - Works much better with `html`, `css` and `js`\n  - Works much much better when `js` polyfills are not needed\n- No styles or themes are provided with this package. You decide how the tabs\n  must look.\n- Support for touch devices\n- Support for keyboard\n- Fully accessible\n- Build with modern javascript, using ES6 modules and custom elements\n\n## Install\n\nRequirements:\n\n- NPM or Yarn to install [the package](https://www.npmjs.com/package/@oom/tab)\n- For browsers\n  [not supporting custom elements](https://caniuse.com/#feat=custom-elementsv1),\n  [you can use this polyfill](https://github.com/webcomponents/custom-elements)\n\n```sh\nnpm install @oom/tab\nnpm install @webcomponents/custom-elements\n```\n\n## Usage\n\n### HTML\n\nLet's start with the following html code:\n\n```html\n\u003cmy-tabs role=\"region\"\u003e\n     \u003cul role=\"tablist\"\u003e\n        \u003cli role=\"presentation\"\u003e\n            \u003ca href=\"#section1\" role=\"tab\" id=\"tab1\" aria-selected=\"true\"\u003e\n                Section 1\n            \u003c/a\u003e\n        \u003c/li\u003e\n        \u003cli role=\"presentation\"\u003e\n            \u003ca href=\"#section2\" role=\"tab\" id=\"tab2\"\u003e\n                Section 2\n            \u003c/a\u003e\n        \u003c/li\u003e\n        \u003cli role=\"presentation\"\u003e\n            \u003ca href=\"#section3\" role=\"tab\" id=\"tab3\"\u003e\n                Section 3\n            \u003c/a\u003e\n        \u003c/li\u003e\n    \u003c/ul\u003e\n\n    \u003csection id=\"section1\" aria-labelledby=\"tab1\" role=\"tabpanel\"\u003e\n        Content section 1\n    \u003c/section\u003e\n\n    \u003csection id=\"section2\" aria-labelledby=\"tab2\" role=\"tabpanel\"\u003e\n        Content section 2\n    \u003c/section\u003e\n\n    \u003csection id=\"section3\" aria-labelledby=\"tab3\" role=\"tabpanel\"\u003e\n        Content section 3\n    \u003c/section\u003e\n\u003c/my-tabs\u003e\n```\n\n### CSS\n\nUse css to define the tab panel appearance:\n\n```css\n/* This makes the tabs works without javascript */\nsection:not(:target) {\n    display: none;\n}\n\n[role=\"tablist\"] {\n    display: flex;\n    list-style: none;\n    padding: 0;\n}\n```\n\n### JS\n\nAnd finally use javascript for a complete experience:\n\n```js\nimport Tab from \"./tab/tab.js\";\n\n//Register the custom element\ncustomElements.define(\"my-tabs\", Tab);\n```\n\n## API\n\nThis is a custom element that extends `HtmlElement`, so it innerit the same api\nof a standard html element with the following additions:\n\n```js\n//Select the element\nconst element = document.querySelector(\"my-tabs\");\n\n//Change the tab state\nelement.setState(\"#section2\");\n\n//Get the currently selected tabpanel element\nconsole.log(element.panel);\n\n//Get the currently selected tab element\nconsole.log(element.tab);\n```\n\n## Demo and tests\n\n- Demo: https://oom-components.github.io/tab/demo/\n- Tests: https://oom-components.github.io/tab/tests/\n\nTo run the demo locally, just clone this repository, enter in the directory and\nexecute:\n\n```sh\nnpm install\nnpm start\n```\n\nYou should see something in the following urls:\n\n- Demo: `http://localhost:8080/demo`\n- Test: `http://localhost:8080/tests`\n","funding_links":[],"categories":["Uncategorized"],"sub_categories":["Uncategorized"],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Foom-components%2Ftab","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Foom-components%2Ftab","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Foom-components%2Ftab/lists"}