{"id":26417080,"url":"https://github.com/makuko/zag-angular","last_synced_at":"2026-01-14T23:30:33.174Z","repository":{"id":279792938,"uuid":"940035779","full_name":"makuko/zag-angular","owner":"makuko","description":"An Angular wrapper for zag","archived":false,"fork":false,"pushed_at":"2025-09-29T16:01:38.000Z","size":880,"stargazers_count":2,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-11-22T21:03:24.123Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"TypeScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/makuko.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"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":"2025-02-27T14:08:27.000Z","updated_at":"2025-09-29T16:00:49.000Z","dependencies_parsed_at":"2025-02-27T18:18:03.428Z","dependency_job_id":"99477bf4-a07c-4643-bb8e-92bd12edbf6a","html_url":"https://github.com/makuko/zag-angular","commit_stats":null,"previous_names":["makuko/zag-js-angular"],"tags_count":16,"template":false,"template_full_name":null,"purl":"pkg:github/makuko/zag-angular","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/makuko%2Fzag-angular","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/makuko%2Fzag-angular/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/makuko%2Fzag-angular/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/makuko%2Fzag-angular/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/makuko","download_url":"https://codeload.github.com/makuko/zag-angular/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/makuko%2Fzag-angular/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":28438402,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-01-14T22:37:52.437Z","status":"ssl_error","status_checked_at":"2026-01-14T22:37:31.496Z","response_time":107,"last_error":"SSL_read: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"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":"2025-03-18T01:01:42.062Z","updated_at":"2026-01-14T23:30:33.150Z","avatar_url":"https://github.com/makuko.png","language":"TypeScript","readme":"# Getting Started\n\nThis package allows you to use Zag with Angular.\n\nTo get Zag running, you'll need to:\n\n1. Install the machine for the component you're interested in. Let's say you\n   want to use the `tooltip` machine.\n\n```bash\nnpm install @zag-js/tooltip\n# or\nyarn add @zag-js/tooltip\n```\n\n2. Install the adapter for Angular.\n\n```bash\nnpm install zag-angular\n# or\nyarn add zag-angular\n```\n\n\u003e Congrats! You're ready to use tooltip machine in your project.\n\n## Using the machine\n\nHere's an example of the tooltip machine used in an Angular project.\n\n```ts\nimport { Component, computed, type Signal } from \"@angular/core\";\nimport * as tooltip from \"@zag-js/tooltip\";\nimport { createId, normalizeProps, useMachine, ZagIt } from \"zag-angular\";\n\n@Component({\n  selector: \"app-tooltip\",\n  standalone: true,\n  imports: [ZagIt],\n  template: `\n    \u003cbutton [zagIt]=\"api().getTriggerProps()\"\u003eHover me\u003c/button\u003e\n    @if (api().open) {\n      \u003cdiv [zagIt]=\"api().getPositionerProps()\"\u003e\n        \u003cdiv [zagIt]=\"api().getContentProps()\"\u003eTooltip\u003c/div\u003e\n      \u003c/div\u003e\n    }\n  `\n})\nexport class TooltipComponent {\n  api: Signal\u003ctooltip.Api\u003e;\n  constructor() {\n    const service = useMachine(tooltip.machine, { id: createId() });\n\n    this.api = computed(() =\u003e tooltip.connect(service, normalizeProps));\n  }\n}\n```\n\nNotice that we imported the `ZagIt` directive. This is necessary because Angular\ndoesn't have \"spread props\". This directive emulates this behavior and updates all\nattributes and event listeners when its input changes.\n\nThere's also a `createId` helper function provided that creates unique IDs in case\nyou need it.\n\n## Using ZagIt as host directive\n\nSometimes we want to use `ZagIt` as a host directive to use the host element as\na part of the state machine. Since Angular doesn't provide a way to set inputs on\nhost directives `ZagIt` needs to be injected and the input needs to be provided\nin the constructor instead of the template. Here's an example using the collapsible\nmachine:\n\n```ts\nimport { Component, computed, inject, type Signal } from \"@angular/core\";\nimport * as collapsible from \"@zag-js/collapsible\";\nimport { createId, normalizeProps, useMachine, ZagIt } from \"zag-angular\";\n\n@Component({\n  selector: \"app-collapsible\",\n  standalone: true,\n  imports: [ZagIt],\n  template: `\n    \u003cbutton [zagIt]=\"api().getTriggerProps()\"\u003eCollapse Trigger\u003c/button\u003e\n    \u003cdiv [zagIt]=\"api().getContentProps()\"\u003eCollape Content\u003c/div\u003e\n  `,\n  hostDirectives: [ZagIt]\n})\nexport class CollapsibleComponent {\n  api: Signal\u003ccollapsible.Api\u003e;\n  zagIt = inject(ZagIt);\n  constructor() {\n    const service = useMachine(collapsible.machine, { id: createId() });\n\n    this.api = computed(() =\u003e collapsible.connect(service, normalizeProps));\n\n    this.zagIt.next = computed(() =\u003e this.api().getRootProps());\n  }\n}\n```\n","funding_links":[],"categories":["Framework Interoperability"],"sub_categories":["Wrappers"],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmakuko%2Fzag-angular","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmakuko%2Fzag-angular","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmakuko%2Fzag-angular/lists"}