{"id":18578415,"url":"https://github.com/auroratide/tagify","last_synced_at":"2025-05-16T02:10:49.797Z","repository":{"id":34923988,"uuid":"191278138","full_name":"Auroratide/tagify","owner":"Auroratide","description":"Higher-order component for adding HTML5 tagnames to a component","archived":false,"fork":false,"pushed_at":"2023-01-03T23:52:38.000Z","size":735,"stargazers_count":0,"open_issues_count":12,"forks_count":0,"subscribers_count":0,"default_branch":"master","last_synced_at":"2025-04-19T10:20:28.567Z","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":"isc","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/Auroratide.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":"2019-06-11T02:23:26.000Z","updated_at":"2019-07-13T16:15:26.000Z","dependencies_parsed_at":"2023-01-15T10:31:40.278Z","dependency_job_id":null,"html_url":"https://github.com/Auroratide/tagify","commit_stats":null,"previous_names":[],"tags_count":1,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Auroratide%2Ftagify","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Auroratide%2Ftagify/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Auroratide%2Ftagify/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Auroratide%2Ftagify/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/Auroratide","download_url":"https://codeload.github.com/Auroratide/tagify/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":254453667,"owners_count":22073618,"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-06T23:35:10.900Z","updated_at":"2025-05-16T02:10:49.780Z","avatar_url":"https://github.com/Auroratide.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# tagify\n\n**tagify** is a simple Higher-Order Component that allows you to succinctly define what HTML tag a component should use.\n\nLet's say you have a generic `Container` component which just adds the `container` class name to the element and defines some CSS. You could make the component always be a `div`, but we're big fans of accessibility, so we wanna use those nice and juicy _semantic tags_. Wouldn't it be nice if we could just do this?\n\n```jsx\nconst Page = () =\u003e\n  \u003c\u003e\n    \u003cContainer.header\u003e\n      My Website\n    \u003c/Container.header\u003e\n    \u003cContainer.section\u003e\n      This is the world's greatest website.\n    \u003c/Container.section\u003e\n    \u003cContainer.footer\u003e\n      Because it's so simple, it has no bugs.\n    \u003c/Container.footer\u003e\n  \u003c/\u003e\n```\n\nWell, with **tagify** you can!\n\n## How to use\n\nThree simple steps:\n\n1. Define your component to take a dynamic tag\n2. Apply the **tagify** higher-order component\n3. Use your new component with joy!\n\n### 1) Define your component to take a dynamic tag\n\n`Tag` will become a prop on your component, provided by the `tagify` function in Step 2.\n\n```jsx\nconst MyComponent = ({ Tag, children, ...props }) =\u003e\n  \u003cTag {...props}\u003e\n    {children}\n  \u003c/Tag\u003e;\n```\n\n_Note: There's nothing related to the tagify library in this step!_\n\n### 2) Apply the tagify higher-order component\n\n```js\nimport tagify from '@auroratide/tagify';\n\ntagify(MyComponent)\n```\n\n### 3) Use your new component with joy!\n\n```jsx\n\u003cMyComponent.blockquote className='left'\u003e\n  This component is awesome.\n\u003c/MyComponent.blockquote\u003e\n```\n\n## Options\n\nYou can specify some additional options as a second parameter to the `tagify` function. Here are the allowed options:\n\n```\n{\n  include: [ List of tag names as strings ],\n  exclude: [ List of tag names as strings ],\n  default: string\n}\n```\n\n### Include List\n\nUse the `include` option to specify a list of tags the component will use. All other tags will be excluded.\n\n```jsx\nimport tagify, { tags } from '@auroratide/tagify';\n\ntagify(MyComponent, {\n  include: [ tags.article, tags.section ]\n});\n\n// Valid\n\u003cMyComponent.article /\u003e\n\n// Invalid\n\u003cMyComponent.div /\u003e\n```\n\n### Exclude List\n\nUse the `exclude` option to specify a list of tags the component should _not_ use. All other tags will be included. Yep, it's the opposite of the include list!\n\n```jsx\nimport tagify, { tags } from '@auroratide/tagify';\n\ntagify(MyComponent, {\n  exclude: [ tags.ul, tags.ol ]\n});\n\n// Valid\n\u003cMyComponent.div /\u003e\n\n// Invalid\n\u003cMyComponent.ol /\u003e\n```\n\n### Default Tag\n\nUse the `default` option to specify a tag that should be used when one isn't specified.\n\n```jsx\nimport tagify, { tags } from '@auroratide/tagify';\n\ntagify(MyComponent, {\n  default: tag.div\n});\n\n// Will use \u003cdiv\u003e tag\n\u003cMyComponent /\u003e\n```","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fauroratide%2Ftagify","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fauroratide%2Ftagify","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fauroratide%2Ftagify/lists"}