webiny-website-builder
Skill này làm gì
Giải thích cách tạo component cho trình chỉnh sửa, cài đặt đầu vào và theme cho website Website Builder được xây bằng Next.js. Dành cho lập trình viên front-end muốn có khối xây dựng riêng trong trình chỉnh sửa Webiny.
Khi nào nên dùng
- ✓Khi lập trình viên muốn tạo một component mới cho trình chỉnh sửa Webiny Website Builder.
- ✓Khi lập trình viên cần thêm đầu vào như cài đặt văn bản, màu hoặc hình ảnh cho một component.
- ✓Khi lập trình viên muốn thiết lập theme với biến CSS cho website Website Builder.
Liên kết skill
https://github.com/webiny/webiny-js/blob/next/skills/user-skills/website-builder/SKILL.mdSao chép rồi dán vào AI của bạn (Claude, ChatGPT hoặc Cursor) và nhờ nó làm theo hướng dẫn.
Cách dùng
Cách dễ nhất: sao chép tin nhắn và dán vào AI của bạn. AI sẽ đọc skill và làm theo hướng dẫn.
Tin nhắn có sẵn để dán
Dành cho Claude Code, Codex hoặc Cursor: chạy lệnh trong thư mục dự án của bạn và skill sẽ được cài đặt.
Tải tệp SKILL.md về và thả vào thư mục skill của agent.
Ví dụ cách nhờ AI
“Làm sao để tạo một nút tùy chỉnh mà tôi có thể chỉnh sửa trong Webiny Website Builder?”
5 skill mới mỗi tuần. Đọc chỉ 1 phút.
Cách hoạt động
Skill giải thích rằng trình chỉnh sửa tải ứng dụng Next.js thật và các component được đăng ký bằng code. Skill chỉ cách định nghĩa các đầu vào người dùng có thể thay đổi và cách tạo kiểu cho theme.
Nội dung kỹ thuật (SKILL.md gốc)
Lấy nguyên văn từ GitHub, do tác giả viết bằng tiếng Anh.
Website Builder
TL;DR
The Webiny Website Builder uses a unique architecture: the Admin editor loads your Next.js app inside an iframe. All component code and styles live in your Next.js project -- Webiny only stores the page structure (which components and what input values). You build editor components with @webiny/website-builder-nextjs, register them via createComponent(), define configurable inputs, and manage theming through CSS custom properties and createTheme().
Architecture
+----------------------------------------------------------+
| Webiny Admin |
| +----------------------------------------------------+ |
| | Website Builder Editor | |
| | | |
| | sidebar +------------------------------+ | |
| | (inputs) | your Next.js app (iframe) | | |
| | | real components | | |
| | | real styles | | |
| | +------------------------------+ | |
| +----------------------------------------------------+ |
+----------------------------------------------------------+
postMessage (SDK)
+----------------------------------------------------------+
| Your Next.js App (running separately) |
| @webiny/website-builder-nextjs SDK installed |
+----------------------------------------------------------+
Key implications:
- No style clashes -- your components, your styles, full ownership
- Genuine WYSIWYG -- editors see your real app, not a simulation
- Framework-owned code -- all React components live in your Next.js repo
Setup
Starter Kit
git clone https://github.com/webiny/website-builder-nextjs.git my-website
cd my-website
npm install
Ensure @webiny/website-builder-nextjs and @webiny/sdk versions in package.json match your Webiny version (yarn webiny --version in your Webiny project).
Environment Variables
# .env
NEXT_PUBLIC_WEBSITE_BUILDER_API_KEY=your_wb_api_key
NEXT_PUBLIC_WEBSITE_BUILDER_API_HOST=https://your-cloudfront-url.cloudfront.net
NEXT_PUBLIC_WEBSITE_BUILDER_ADMIN_HOST=http://localhost:3001
NEXT_PUBLIC_WEBSITE_BUILDER_API_TENANT=root
Editor Components
An editor component has two parts:
- React component -- renders the UI, receives configured values via
inputsprop - Manifest -- metadata (name, label, group, inputs) that tells the editor about the component
Creating a Component
// src/editorComponents/Banner.tsx
import React from "react";
import { ComponentProps } from "@webiny/website-builder-nextjs";
interface BannerInputs {
headline: string;
ctaLabel: string;
ctaUrl: string;
}
export function Banner({ inputs: { headline, ctaLabel, ctaUrl } }: ComponentProps<BannerInputs>) {
return (
<div className="bg-primary py-12 px-6 text-center text-white">
<h2 className="text-3xl font-bold mb-4">{headline}</h2>
{ctaLabel && ctaUrl && (
<a
href={ctaUrl}
className="inline-block bg-white text-primary font-semibold px-6 py-3 rounded-md"
>
{ctaLabel}
</a>
)}
</div>
);
}
Registering Components
The editorComponents array must be in a "use client" file:
// src/editorComponents/index.tsx
"use client";
import { createComponent, createTextInput } from "@webiny/website-builder-nextjs";
import { Banner } from "./Banner";
export const editorComponents = [
createComponent(Banner, {
name: "Custom/Banner",
label: "Banner",
group: "custom",
inputs: [
createTextInput({
name: "headline",
label: "Headline",
description: "The main headline text.",
defaultValue: "Ready to get started?"
}),
createTextInput({
name: "ctaLabel",
label: "Button Label",
defaultValue: "Get started"
}),
createTextInput({
name: "ctaUrl",
label: "Button URL",
defaultValue: "/"
})
]
})
];
Important: The "use client" directive is required because component registration communicates with the editor via the browser. However, components imported here can still be Server Components if they don't have their own "use client" directive.
Component Name Convention
Use a namespaced string: `"YourNamespace/C
Câu hỏi thường gặp
Code của component nằm ở đâu?
Nó nằm trong dự án Next.js, không nằm trong Webiny. Webiny chỉ lưu component nào mà một trang dùng và các giá trị được nhập cho chúng.
Một component có thể có những loại đầu vào nào?
Skill liệt kê các đầu vào như văn bản, số, boolean, màu, select, file hoặc hình ảnh, slot, rich text, object và tags.
Theme hoạt động thế nào?
Skill giải thích cách quản lý màu sắc và kiểu dáng bằng CSS custom properties và một hàm thiết lập theme.
Chi tiết
Mô tả gốc của tác giả
Building Website Builder editor components, theming, and CMS integration using @webiny/website-builder-nextjs. Use this skill when the developer wants to create editor components for the Website Builder, register components with createComponent, define configurable inputs (text, number, boolean, color, select, file/image, slot, lexical, object, tags), type the component's props correctly (especially file/image inputs, which are objects with { src, width, height, ... } and NOT plain strings, and lexical inputs which are { html, state } objects), set up component groups, customize the theme (CSS
repo: webiny/webiny-js
Độ phổ biến
- Sao GitHub
- 8.1k
- Vị trí xếp hạng
- #12618
- Giấy phép
- —
- Cập nhật
- 2/11/2026
Bình luận
- …
Thêm skill từ kho mã này
prd-to-plan
8.1kGiúp agent của bạn biến tài liệu yêu cầu sản phẩm thành kế hoạch theo giai đoạn gồm các lát cắt đầu-cuối nhỏ, lưu thành file Markdown.
webiny-admin-architect
8.1kDạy agent của bạn cách xây dựng màn hình quản trị cho nền tảng Webiny, dùng các tầng logic nghiệp vụ và mẫu presenter.
webiny-admin-permissions
8.1kDạy agent của bạn thêm kiểm soát quyền vào màn hình quản trị Webiny, gồm form quyền tự sinh và kiểm tra ẩn hoặc hiện.
webiny-form-model
8.1kDạy agent của bạn xây dựng form trong Webiny bằng trình tạo trường khai báo, bố cục, kiểm tra hợp lệ và quy tắc có điều kiện.
Skill tương tự
angular-developer
280kGiúp agent của bạn viết code Angular và tư vấn cấu trúc dự án, hữu ích khi bắt đầu dự án mới hoặc cải thiện hiệu suất.
frontend-a11y
280kGiúp agent của bạn làm cho giao diện web dễ tiếp cận với mọi người. Đảm bảo website và ứng dụng hoạt động tốt với trình đọc màn hình và điều hướng bằng bàn phím.
frontend-patterns
280kGiúp agent của bạn áp dụng các mẫu hiện đại trong phát triển frontend. Tối ưu hiệu năng, quản lý trạng thái và tuân theo thực hành tốt nhất với React và Next.js.