npx skills add https://github.com/wix/skills --skill wix-cli-dashboard-page为 Wix CLI 应用程序创建功能齐全的仪表板页面扩展。仪表板页面出现在 Wix 网站所有者的仪表板中,使网站管理员能够管理数据、配置设置和执行管理任务。
创建仪表板页面时,请按顺序遵循以下步骤:
src/extensions/dashboard/pages/<页面名称>/page.tsx,其中包含包裹在 WixDesignSystemProvider 中的 WDS 组件extensions.dashboardPage() 和唯一 UUID 的 extensions.tssrc/extensions.ts 以导入和使用新的扩展完整文档请参阅 Wix 数据参考。
广告位招租
在这里展示您的产品或服务
触达数万 AI 开发者,精准高效
items.query('Collection').filter/sort.limit.find() → { items, totalCount, hasNext }items.insert | update | remove。确保集合权限允许该操作查询方法: eq, ne, gt, ge, lt, le, between, contains, startsWith, endsWith, hasSome, hasAll, isEmpty, isNotEmpty, and, or, not, ascending, descending, limit, skip, include
完整文档,包括所有方法、页面 ID 和示例,请参阅 仪表板 API 参考。
关键方法:
dashboard.navigate() - 在仪表板页面之间导航dashboard.observeState() - 接收上下文状态和环境信息dashboard.showToast() - 显示 toast 通知dashboard.openModal() - 打开仪表板模态扩展(参见 wix-cli-dashboard-modal)dashboard.navigateBack() - 导航回上一页dashboard.getPageUrl() - 获取仪表板页面的完整 URLdashboard.openMediaManager() - 打开 Wix 媒体管理器dashboard.onBeforeUnload() - 注册 beforeunload 处理程序dashboard.addSitePlugin() - 将站点插件添加到插槽dashboard.setPageTitle() - 在浏览器标签页中设置页面标题dashboard.onLayerStateChange() - 处理前台/后台状态更改关键:在仪表板页面中使用模态框
当您需要从仪表板页面显示弹出表单、确认框、详情视图或任何对话框覆盖层时,您必须使用仪表板模态框,而不是常规的 React 模态框或 WDS Modal 组件。
Modal 组件或自定义的 React 模态实现仪表板模态框使用 dashboard.openModal() 打开,并提供与仪表板生命周期、状态管理和导航的适当集成。
电商导航: 特定于电商的导航助手,请参阅 电商导航参考。
当构建用于配置嵌入式脚本的仪表板页面时,完整实现指南请参阅 动态参数参考。
要点:
@wix/app-management 的 embeddedScriptswithProviders 包装器仪表板页面位于 src/extensions/dashboard/pages 下。每个页面都有自己的文件夹。
文件结构:
src/extensions/dashboard/pages/<页面>/page.tsx — 页面组件关键元数据字段:
id (字符串, GUID): 用于注册页面的唯一页面 IDtitle (字符串): 用于浏览器标签页和可选的侧边栏标签additionalRoutes (字符串数组, 可选): 指向此页面的额外路由sidebar.disabled (布尔值, 可选): 从侧边栏隐藏页面(默认 false)sidebar.priority (数字, 可选): 侧边栏排序;数值越低优先级越高sidebar.whenActive.selectedPageId (字符串, 可选): 当此页面激活时,哪个页面显示为选中状态sidebar.whenActive.hideSidebar (布尔值, 可选): 当此页面激活时隐藏侧边栏将您的仪表板页面组件包裹在 WixDesignSystemProvider 中,以启用 WDS 组件和主题。您还必须导入 WDS 组件的全局 CSS 样式,以确保正确渲染。
import { WixDesignSystemProvider } from "@wix/design-system";
import '@wix/design-system/styles.global.css';
export default function () {
return (
<WixDesignSystemProvider>
<Page>
<Page.Header
title="我的页面"
subtitle="这是您页面的副标题"
/>
<Page.Content>
<EmptyState title="我的页面" subtitle="你好,世界!" theme="page" />
</Page.Content>
</Page>
</WixDesignSystemProvider>
);
}
注意: 使用动态参数时,请改用 withProviders 包装器。详情请参阅 动态参数。
Modal 组件或自定义的 React 模态实现 - 对于任何弹出对话框、表单或覆盖层,始终使用仪表板模态框(参见 wix-cli-dashboard-modal)请求: "创建一个用于管理博客文章的仪表板页面"
输出: 包含显示文章的表格、搜索工具栏、添加/编辑/删除操作、空状态的页面。
请求: "为通知偏好设置构建一个设置页面"
输出: 包含表单字段、带有 toast 确认的保存按钮、未保存更改警告的页面。
请求: "为客户订单创建一个管理面板"
输出: 包含订单表格、状态徽章、过滤器、详情仪表板模态框(使用 wix-cli-dashboard-modal)、状态更新操作的页面。
请求: "为优惠券弹出嵌入式脚本创建一个设置页面"
输出: 包含弹出窗口标题、优惠券代码、最低购物车价值和启用切换的表单字段的页面。使用 embeddedScripts API 加载/保存参数。
// 嵌入式脚本配置页面的关键模式
import { embeddedScripts } from "@wix/app-management";
// 挂载时加载
useEffect(() => {
const load = async () => {
const script = await embeddedScripts.getEmbeddedScript();
const data = script.parameters || {};
setOptions({
headline: data.headline || "默认",
enabled: data.enabled === "true",
threshold: Number(data.threshold) || 0,
});
};
load();
}, []);
// 保存处理程序
const handleSave = async () => {
await embeddedScripts.embedScript({
parameters: {
headline: options.headline,
enabled: String(options.enabled),
threshold: String(options.threshold),
},
});
dashboard.showToast({ message: "已保存!", type: "success" });
};
扩展注册是强制性的,并且需要两个步骤。
每个仪表板页面都需要在其文件夹中有一个 extensions.ts 文件:
文件: src/extensions/dashboard/pages/<页面名称>/extensions.ts
import { extensions } from "@wix/astro/builders";
export const dashboardpageMyPage = extensions.dashboardPage({
id: "{{生成_UUID}}",
title: "我的页面",
routePath: "my-page",
component: "./extensions/dashboard/pages/my-page/page.tsx",
});
关键:UUID 生成
id 必须是一个唯一的、静态的 UUID v4 字符串。为每个扩展生成一个新的 UUID - 请勿使用 randomUUID() 或从示例中复制 UUID。将 {{生成_UUID}} 替换为类似 "a1b2c3d4-e5f6-7890-abcd-ef1234567890" 的新生成的 UUID。
| 属性 | 类型 | 描述 |
|---|---|---|
id | 字符串 | 唯一的静态 UUID v4(生成新的 - 参见上面的说明) |
title | 字符串 | 在仪表板侧边栏中显示的标题 |
routePath | 字符串 | URL 路径段。仅限小写字母、数字、短横线和斜杠。不得以斜杠开头。 |
component | 字符串 | 指向页面组件 (.tsx) 的相对路径 |
关键: 创建页面特定的扩展文件后,您必须阅读 wix-cli-extension-registration 并按照 "应用注册" 部分更新 src/extensions.ts。
如果不完成步骤 2,仪表板页面将不会出现在 Wix 仪表板中。
与其他扩展类型的 API 混淆:
| 错误(嵌入式脚本 API) | 正确(仪表板页面 API) |
|---|---|
name: "..." | title: "..." |
source: "..." | component: "..." |
route: "..." | routePath: "..." |
请勿从嵌入式脚本或其他扩展注册中复制字段名称。仪表板页面使用 title、routePath 和 component。
令牌限制: 您的最大输出约为 10,000 个令牌。您必须规划您的响应,使其远低于此限制。
简洁规则: 在保持质量和正确性的同时,最小化输出令牌。
模块化代码策略: 当生成大量代码时,拆分为多个带有导入的小文件:
当提供 API 规范时,您可以向这些端点发出 API 调用。有关如何在仪表板页面中使用 API 规范的详细信息,请参阅 API 规范参考。
布局决定了用户如何与您的仪表板内容交互。它建立了仪表板页面的结构、层次和节奏,有助于整体的一致性和用户体验。通过深思熟虑和精心计算地组织内容,用户可以更顺畅地浏览,在完成任务时节省时间和减少挫败感。
要创建针对用户体验优化的仪表板页面,请遵循以下设计原则:
仪表板页面设计用于适应各种屏幕尺寸,而不是针对特定分辨率定制。主要内容应位于页面顶部,以确保用户立即理解页面的目的。
注意: 显示在页面顶部 600 像素内的内容对大多数用户都是可见的。
基础单位建立了所有元素和测量值相乘的增量。这种做法确保了设计元素间距和大小的统一性。
注意: 设计系统基于 6px 单位。
布局网格、间距令牌以及几乎所有视觉元素和尺寸都遵循六的倍数(6, 12, 18, 24 等),只有少数例外。
| 令牌 | 尺寸 | 用于 |
|---|---|---|
| SP1 | 6px | 组件之间的间距 |
| SP2 | 12px | 组件之间的间距 |
| SP3 | 18px | 组件之间的间距 |
| SP4 | 24px | 组件之间的间距,布局间距 |
| SP5 | 30px | 布局间距 |
| SP6 | 36px | 布局间距 |
| SP7 | 42px | 布局间距 |
| SP8 | 48px | 布局间距 |
| SP10 | 54px | 布局间距 |
| SP11 | 60px | 布局间距 |
要最好地设计您的应用程序布局,请了解:
仪表板应用框架被大多数 Wix 应用程序设置使用。仪表板页面包含 4 个区域:
| 区域 | 用途 |
|---|---|
| 1. 全局导航(顶部栏) | 页面顶部的通用导航,允许用户在不同环境之间导航。全宽容器,固定高度为 48px。 |
| 2. 侧边栏导航 | 环境的本地导航。容器固定宽度为 228px。 |
| 3. 内容区域 | 页面内容区域,宽度自适应屏幕尺寸。 |
| 4. 侧面板(可选) | 一个可选面板,显示与页面内容相关的附加操作或内容。固定宽度为 420px。可以覆盖主内容区域或从右侧推动主内容区域。 |
侧面板指南:
该系统使用具有固定最大宽度的流体网格布局。它使用可缩放和调整内容大小的列。
网格由 3 个元素构成:
网格规格:
页面布局可以根据意图分为以下类型:
表单是允许用户填写数据或编辑现有数据的页面。有两种变体:
两种表单页面布局在页眉和页脚区域都包含强制性的保存和取消操作。
2/3 布局最佳实践:
全宽布局最佳实践:
组合布局:
注意: 如果一列足够宽以容纳平均每行 10 个单词,则易于阅读。
展示页面展示数据或内容,不接受用户输入。它们可以包含次要操作,例如数据过滤。
列表(表格):
列表(网格)选项:
网格选择考虑因素:
仪表板: 使用组合网格在特定主题上显示不同类型的数据。
列跨度建议:
空状态:
营销页面推广网站所有者尚不了解的新产品。使用 <MarketingPageLayout/> 组件构建,分为 2 列:
可选的页脚区域可以显示功能列表或推荐列表。
向导页面引导用户完成产品或功能的设置。它们将复杂的表单分解为多个步骤,以便于完成。
入口点:
注意: 向导必须有一个最终目的地。完成所有步骤后,用户应到达相关页面:仪表板、详情页面或任何其他相关位置。
<Page /> - 主页面包装器<Layout /> - 网格布局容器<MarketingPageLayout /> - 营销页面包装器<Card /> - 内容容器,卡片之间有 24px 的间隙每周安装量
188
代码仓库
GitHub 星标数
3
首次出现
2026 年 1 月 26 日
安全审计
安装于
opencode166
cursor93
codex88
gemini-cli85
github-copilot82
kimi-cli77
Creates full-featured dashboard page extensions for Wix CLI applications. Dashboard pages appear in the Wix site owner's dashboard and enable site administrators to manage data, configure settings, and perform administrative tasks.
Follow these steps in order when creating a dashboard page:
src/extensions/dashboard/pages/<page-name>/page.tsx with WDS components wrapped in WixDesignSystemProviderextensions.ts with extensions.dashboardPage() and unique UUIDsrc/extensions.ts to import and use the new extensionSee Wix Data Reference for complete documentation.
Summary:
items.query('Collection').filter/sort.limit.find() → { items, totalCount, hasNext }items.insert | update | remove. Ensure collection permissions allow the actionQuery methods: eq, ne, gt, ge, lt, le, between, contains, startsWith, endsWith, hasSome, hasAll, , , , , , , , , ,
See Dashboard API Reference for complete documentation including all methods, page IDs, and examples.
Key methods:
dashboard.navigate() - Navigate between dashboard pagesdashboard.observeState() - Receive contextual state and environmental informationdashboard.showToast() - Display toast notificationsdashboard.openModal() - Open dashboard modal extensions (see wix-cli-dashboard-modal)dashboard.navigateBack() - Navigate back to previous pagedashboard.getPageUrl() - Get full URL for a dashboard pagedashboard.openMediaManager() - Open Wix Media Managerdashboard.onBeforeUnload() - Register beforeunload handlerCRITICAL: Using Modals in Dashboard Pages
When you need to display popup forms, confirmations, detail views, or any dialog overlays from a dashboard page, you MUST use dashboard modals, not regular React modals or WDS Modal components.
Modal component or custom React modal implementationsDashboard modals are opened using dashboard.openModal() and provide proper integration with the dashboard lifecycle, state management, and navigation.
Ecom Navigation: See Ecom Navigation Reference for ecom-specific navigation helpers.
When building a dashboard page to configure an embedded script, see Dynamic Parameters Reference for complete implementation guide.
Key points:
embeddedScripts from @wix/app-managementwithProviders wrapper when dynamic parameters are presentDashboard pages live under src/extensions/dashboard/pages. Each page has its own folder.
File structure:
src/extensions/dashboard/pages/<page>/page.tsx — page componentKey metadata fields:
id (string, GUID): Unique page ID used to register the pagetitle (string): Used for browser tab and optional sidebar labeladditionalRoutes (string[], optional): Extra routes leading to this pagesidebar.disabled (boolean, optional): Hide page from sidebar (default false)sidebar.priority (number, optional): Sidebar ordering; lower is higher prioritysidebar.whenActive.selectedPageId (string, optional): Which page appears selected when this page is activesidebar.whenActive.hideSidebar (boolean, optional): Hide sidebar when this page is activeWrap your dashboard page component with WixDesignSystemProvider to enable WDS components and theming. You must also import the global CSS styles for WDS components to render correctly.
import { WixDesignSystemProvider } from "@wix/design-system";
import '@wix/design-system/styles.global.css';
export default function () {
return (
<WixDesignSystemProvider>
<Page>
<Page.Header
title="My Page"
subtitle="This is a subtitle for your page"
/>
<Page.Content>
<EmptyState title="My Page" subtitle="Hello World!" theme="page" />
</Page.Content>
</Page>
</WixDesignSystemProvider>
);
}
Note: When using dynamic parameters, use the withProviders wrapper instead. See Dynamic Parameters for details.
Modal component or custom React modal implementations - Always use dashboard modals (see wix-cli-dashboard-modal) for any popup dialogs, forms, or overlaysRequest: "Create a dashboard page to manage blog posts"
Output: Page with table displaying posts, search toolbar, add/edit/delete actions, empty state.
Request: "Build a settings page for notification preferences"
Output: Page with form fields, save button with toast confirmation, unsaved changes warning.
Request: "Create an admin panel for customer orders"
Output: Page with orders table, status badges, filters, detail dashboard modal (using wix-cli-dashboard-modal), status update actions.
Request: "Create a settings page for the coupon popup embedded script"
Output: Page with form fields for popup headline, coupon code, minimum cart value, and enable toggle. Uses embeddedScripts API to load/save parameters.
// Key pattern for embedded script configuration pages
import { embeddedScripts } from "@wix/app-management";
// Load on mount
useEffect(() => {
const load = async () => {
const script = await embeddedScripts.getEmbeddedScript();
const data = script.parameters || {};
setOptions({
headline: data.headline || "Default",
enabled: data.enabled === "true",
threshold: Number(data.threshold) || 0,
});
};
load();
}, []);
// Save handler
const handleSave = async () => {
await embeddedScripts.embedScript({
parameters: {
headline: options.headline,
enabled: String(options.enabled),
threshold: String(options.threshold),
},
});
dashboard.showToast({ message: "Saved!", type: "success" });
};
Extension registration is MANDATORY and has TWO required steps.
Each dashboard page requires an extensions.ts file in its folder:
File: src/extensions/dashboard/pages/<page-name>/extensions.ts
import { extensions } from "@wix/astro/builders";
export const dashboardpageMyPage = extensions.dashboardPage({
id: "{{GENERATE_UUID}}",
title: "My Page",
routePath: "my-page",
component: "./extensions/dashboard/pages/my-page/page.tsx",
});
CRITICAL: UUID Generation
The id must be a unique, static UUID v4 string. Generate a fresh UUID for each extension - do NOT use randomUUID() or copy UUIDs from examples. Replace {{GENERATE_UUID}} with a freshly generated UUID like "a1b2c3d4-e5f6-7890-abcd-ef1234567890".
| Property | Type | Description |
|---|---|---|
id | string | Unique static UUID v4 (generate fresh - see note above) |
title | string | Display title in dashboard sidebar |
routePath | string | URL path segment. Lowercase letters, numbers, dashes, and slashes only. Must NOT start with a slash. |
component | string | Relative path to the page component (.tsx) |
CRITICAL: After creating the page-specific extension file, you MUST read wix-cli-extension-registration and follow the "App Registration" section to update src/extensions.ts.
Without completing Step 2, the dashboard page will not appear in the Wix dashboard.
API confusion with other extension types:
| WRONG (Embedded Script API) | CORRECT (Dashboard Page API) |
|---|---|
name: "..." | title: "..." |
source: "..." | component: "..." |
route: "..." | routePath: "..." |
Do NOT copy field names from embedded script or other extension registrations. Dashboard pages use title, routePath, and component.
Token limits: Your max output is ~10,000 tokens. You MUST plan your response to stay well under this limit.
Brevity rules: Minimize output tokens while maintaining quality and correctness.
Modular code strategy: When generating substantial code, split into multiple smaller files with imports:
When an API specification is provided, you can make API calls to those endpoints. See API Spec Reference for details on how to use API specs in dashboard pages.
Layout determines how users interact with your dashboard content. It establishes the structure, hierarchy, and rhythm of your dashboard page, contributing to the overall coherence and user experience. By making mindful and calculated choices in how you organize your content, users can move around more smoothly, saving time and frustration when completing tasks.
To create dashboard pages optimized for user experience, follow these design principles:
Dashboard pages are designed to accommodate various screen sizes rather than being tailored to one specific resolution. The primary content should be at the top of the page to ensure users immediately understand the purpose of the page.
Note: Content displayed in the top 600 pixels of the page will be visible for the majority of users.
The base unit establishes the increment by which all elements and measurements are multiplied. This practice ensures consistency in the spacing and sizing of design elements.
Note: The design system is based on a 6px unit.
The layout grid, spacing tokens, and nearly all visual elements and sizes adhere to multiples of six (6, 12, 18, 24, etc.), with only occasional exceptions.
| TOKEN | SIZE | USE FOR |
|---|---|---|
| SP1 | 6px | Spacing between components |
| SP2 | 12px | Spacing between components |
| SP3 | 18px | Spacing between components |
| SP4 | 24px | Spacing between components, layout spacing |
| SP5 | 30px | Layout spacing |
| SP6 | 36px | Layout spacing |
| SP7 | 42px | Layout spacing |
| SP8 | 48px | Layout spacing |
| SP10 | 54px | Layout spacing |
| SP11 | 60px | Layout spacing |
To best design the layout for your app, understand:
The dashboard app frame is used by the majority of Wix applications settings. Dashboard pages consist of 4 areas:
| AREA | USAGE |
|---|---|
| 1. Global navigation (top bar) | General navigation at the top of a page which allows users to navigate between different environments. Full width container with a fixed height of 48px. |
| 2. Sidebar navigation | Local navigation of an environment. Container with a fixed width of 228px. |
| 3. Content area | Page content area with a width that's adaptive to screen size. |
| 4. Side panel (optional) | An optional panel that shows additional actions or content associated with the content of a page. Fixed width of 420px. Can either overlay the main content area or push it from the right side. |
Side Panel Guidelines:
The system uses a fluid grid layout with a fixed maximum width. It uses columns that scale and resize the content accordingly.
The grid is constructed from 3 elements:
Grid Specifications:
Page layouts can be divided by intention into the following types:
Forms are pages that allow users to fill in data or edit existing data. Two variations:
Both form page layouts include mandatory Save and Cancel actions in the header and footer areas.
2/3 Layout Best Practices:
Full Width Layout Best Practices:
Combining Layouts:
Note: A column is easy to read if it is wide enough to accommodate an average of 10 words per line.
Display pages showcase data or content without accepting input from users. They can contain minor actions such as data filtering.
List (Table):
List (Grid) Options:
Grid Selection Considerations:
Dashboards: Display different types of data on a specific topic using a combination grid.
Column span recommendations:
Empty States:
Marketing pages promote new products that site owners are not aware of yet. Built using the <MarketingPageLayout/> component split into 2 columns:
Optional footer area can display features or testimonials list.
Wizard pages guide users through setting up a product or feature. They split complex forms into steps for easier completion.
Entry Points:
Note: Wizards must have a final destination. After completing all steps, users should end up on a relevant page: a dashboard, a details page, or any other relevant location.
<Page /> - Main page wrapper<Layout /> - Grid layout container<MarketingPageLayout /> - Marketing page wrapper<Card /> - Content container with 24px gaps between cardsWeekly Installs
188
Repository
GitHub Stars
3
First Seen
Jan 26, 2026
Security Audits
Gen Agent Trust HubPassSocketPassSnykPass
Installed on
opencode166
cursor93
codex88
gemini-cli85
github-copilot82
kimi-cli77
React 组合模式指南:Vercel 组件架构最佳实践,提升代码可维护性
113,700 周安装
isEmptyisNotEmptyandornotascendingdescendinglimitskipincludedashboard.addSitePlugin() - Add site plugin to slotsdashboard.setPageTitle() - Set page title in browser tabdashboard.onLayerStateChange() - Handle foreground/background state changes