{"id":30580524,"url":"https://github.com/react-component/tour","last_synced_at":"2025-08-29T05:36:39.078Z","repository":{"id":61629778,"uuid":"542885472","full_name":"react-component/tour","owner":"react-component","description":null,"archived":false,"fork":false,"pushed_at":"2025-05-24T13:17:42.000Z","size":460,"stargazers_count":36,"open_issues_count":13,"forks_count":34,"subscribers_count":5,"default_branch":"master","last_synced_at":"2025-08-25T22:56:06.312Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"tour-dun.vercel.app","language":"TypeScript","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/react-component.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,"publiccode":null,"codemeta":null,"zenodo":null}},"created_at":"2022-09-29T02:43:48.000Z","updated_at":"2025-05-24T13:17:46.000Z","dependencies_parsed_at":"2023-02-19T05:30:41.104Z","dependency_job_id":"1c314bf6-48ef-4ed0-9fa5-604d6771663e","html_url":"https://github.com/react-component/tour","commit_stats":{"total_commits":93,"total_committers":8,"mean_commits":11.625,"dds":0.5053763440860215,"last_synced_commit":"154c66bad620000548c8dc7198a9ebe240c84031"},"previous_names":[],"tags_count":51,"template":false,"template_full_name":"react-component/portal","purl":"pkg:github/react-component/tour","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/react-component%2Ftour","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/react-component%2Ftour/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/react-component%2Ftour/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/react-component%2Ftour/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/react-component","download_url":"https://codeload.github.com/react-component/tour/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/react-component%2Ftour/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":272636151,"owners_count":24967983,"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-08-29T02:00:10.610Z","response_time":87,"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":"2025-08-29T05:36:36.986Z","updated_at":"2025-08-29T05:36:39.060Z","avatar_url":"https://github.com/react-component.png","language":"TypeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# @rc-component/tour\n\nReact 18 supported Tour Component.\n\n[![NPM version][npm-image]][npm-url] [![dumi](https://img.shields.io/badge/docs%20by-dumi-blue?style=flat-square)](https://github.com/umijs/dumi) [![build status][github-actions-image]][github-actions-url] [![Codecov][codecov-image]][codecov-url] [![npm download][download-image]][download-url]\n\n[npm-image]: http://img.shields.io/npm/v/@rc-component/tour.svg?style=flat-square\n[npm-url]: http://npmjs.org/package/@rc-component/tour\n[github-actions-image]: https://github.com/react-component/tour/workflows/CI/badge.svg\n[github-actions-url]: https://github.com/react-component/tour/actions\n[codecov-image]: https://img.shields.io/codecov/c/github/react-component/tour/master.svg?style=flat-square\n[codecov-url]: https://app.codecov.io/gh/react-component/tour\n[download-image]: https://img.shields.io/npm/dm/@rc-component/tour.svg?style=flat-square\n[download-url]: https://npmjs.org/package/@rc-component/tour\n\n## Development\n\n```bash\nnpm install\nnpm start\nopen http://localhost:8000\n```\n\n## Feature\n\n- React life cycle support tour component\n\n## Install\n\n[![@rc-component/tour](https://nodei.co/npm/@rc-component/tour.png)](https://www.npmjs.com/package/@rc-component/tour)\n\n## Usage\n\n\u003c!-- prettier-ignore --\u003e\n```js | pure\nimport Tour from '@rc-component/tour';\n\nconst Demo = () =\u003e {\n    const createBtnRef = useRef\u003cHTMLButtonElement\u003e(null);\n    const updateBtnRef = useRef\u003cHTMLButtonElement\u003e(null);\n    const deleteBtnRef = useRef\u003cHTMLButtonElement\u003e(null);\n    return (\n        \u003cdiv style={{ margin: 20 }}\u003e\n            \u003cdiv\u003e\n                \u003cbutton\n                    className=\"ant-target\"\n                    ref={createBtnRef}\n                    style={{ marginLeft: 100 }}\n                \u003e\n                    Create\n                \u003c/button\u003e\n                \u003cdiv style={{ height: 200 }} /\u003e\n                \u003cbutton className=\"ant-target\" ref={updateBtnRef}\u003e\n                    Update\n                \u003c/button\u003e\n                \u003cbutton className=\"ant-target\" ref={deleteBtnRef}\u003e\n                    Delete\n                \u003c/button\u003e\n            \u003c/div\u003e\n\n            \u003cdiv style={{ height: 200 }} /\u003e\n\n            \u003cTour\n                defaultCurrent={0}\n                steps={[\n                    {\n                        title: '创建',\n                        description: '创建一条数据',\n                        target: () =\u003e createBtnRef.current,\n                        mask: true,\n                    },\n                    {\n                        title: '更新',\n                        description: (\n                            \u003cdiv\u003e\n                                \u003cspan\u003e更新一条数据\u003c/span\u003e\n                                \u003cbutton\u003e帮助文档\u003c/button\u003e\n                            \u003c/div\u003e\n                        ),\n                        target: () =\u003e updateBtnRef.current,\n                    },\n                    {\n                        title: '删除',\n                        description: (\n                            \u003cdiv\u003e\n                                \u003cspan\u003e危险操作：删除一条数据\u003c/span\u003e\n                                \u003cbutton\u003e帮助文档\u003c/button\u003e\n                            \u003c/div\u003e\n                        ),\n                        target: () =\u003e deleteBtnRef.current,\n                        mask: true,\n                        style: { color: 'red' },\n                    },\n                ]}\n            /\u003e\n        \u003c/div\u003e\n    );\n};\n\nexport default Demo;\n```\n\n## 🔥 API\n\nWe use typescript to create the Type definition. You can view directly in IDE. But you can still check the type definition [here](https://github.com/react-component/tour/blob/master/src/interface.ts).\n\n### Tour\n\n\u003c!-- prettier-ignore --\u003e\n| 属性 | 类型 | 默认值 | 说明 |\n| --- | --- | --- | --- |\n| closeIcon | `React.ReactNode` | - | 自定义关闭按钮 |\n| steps | `TourStepProps[]` | - | 引导步骤 |\n| open | `boolean` | `true` | 受控打开引导（与 `current` 受控分开） |\n| current | `number` | 0 | 受控当前处于哪一步 |\n| defaultCurrent | `number` | 0 | 默认处于哪一步 |\n| gap | `{ offset?: number \\| [number, number]; radius?: number }` | - | 控制引导显示间距 |\n| onChange | `(current: number) =\u003e void` | - | 步骤改变时的回调，`current`为改变前的步骤，`next`为改变后的步骤 |\n| onClose | `(current: number) =\u003e void` | - | 关闭引导时的回调 |\n| onFinish | `() =\u003e void` | - | 完成引导时的回调 |\n| mask | `boolean \\| { style?: React.CSSProperties; color?: string; }` | `true` | 整体是否启用蒙层，也可以传入自定义样式修改蒙层样式 |\n| animated | `boolean \\| { placeholder: boolean }` | `false` | 是否启用目标遮罩动画 |\n| arrow | `boolean \\| { pointAtCenter: boolean}` | `true` | 整体是否显示箭头，包含是否指向元素中心的配置 |\n| scrollIntoViewOptions | `boolean \\| ScrollIntoViewOptions` | `true` | 是否支持当前元素滚动到视窗内，也可传入配置指定滚动视窗的相关参数 |\n| onPopupAlign | `function(popupDomNode, align)` | - | 当弹出框对齐后回调 |\n| zIndex | `number` | 1001 | 弹层的层级 |\n\n### TourStep\n\n\u003c!-- prettier-ignore --\u003e\n| 属性 | 类型 | 默认值 | 说明 |\n| --- | --- | --- | --- |\n| closeIcon | `React.ReactNode` | - | 自定义关闭按钮 |\n| target | `() =\u003e HTMLElement` \\|  `HTMLElement` | - | 获取引导卡片指向的元素 |\n| arrow | `boolean` \\| `{ pointAtCenter: boolean}` | `true` | 是否显示箭头，包含是否指向元素中心的配置 |\n| placement | `left` \\| `leftTop` \\| `leftBottom` \\| `right` \\| `rightTop` \\| `rightBottom` \\| `top` \\| `topLeft` \\| `topRight` \\| `bottom`  \\| `bottomLeft` \\| `bottomRight` | `bottom` | 引导卡片相对于目标元素的位置 |\n| onClose | `() =\u003e void` | - | 关闭引导时的回调函数 |\n| mask | `boolean \\| { style?: React.CSSProperties; color?: string; }` | `true` | 是否启用蒙层，也可以传入自定义样式修改蒙层样式，默认跟随 Tour 的 `mask` 属性 |\n| renderPanel | `(props: TourStepProps, current: number) =\u003e ReactNode;` |  | 渲染 popoup 弹窗方法 |\n| className | `string` | - | - |\n| style | `React.CSSProperties` | - | - |\n| scrollIntoViewOptions | `boolean \\| ScrollIntoViewOptions` | `true` | 是否支持当前元素滚动到视窗内，也可传入配置指定滚动视窗的相关参数，默认跟随 Tour 的 `scrollIntoViewOptions` 属性 |\n\n## 🤝 Contributing \n\n\u003ca href=\"https://openomy.app/github/react-component/tour\" target=\"_blank\" style=\"display: block; width: 100%;\" align=\"center\"\u003e\n  \u003cimg src=\"https://openomy.app/svg?repo=react-component/tour\u0026chart=bubble\u0026latestMonth=24\" target=\"_blank\" alt=\"Contribution Leaderboard\" style=\"display: block; width: 100%;\" /\u003e\n\u003c/a\u003e\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Freact-component%2Ftour","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Freact-component%2Ftour","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Freact-component%2Ftour/lists"}