webiny-form-model
Skill này làm gì
Skill này hướng dẫn AI của bạn khi xây dựng form trên nền tảng Webiny. Dành cho lập trình viên muốn các trường, bố cục và kiểm tra hợp lệ được định nghĩa rõ ràng theo kiểu khai báo.
Khi nào nên dùng
- ✓Khi bạn cần định nghĩa trường văn bản, ngày hoặc trường khác cho form Webiny bằng trình tạo.
- ✓Khi bạn muốn tab, hàng hoặc đường phân cách trong bố cục form.
- ✓Khi các trường nên hiện, ẩn hoặc kiểm tra hợp lệ tùy theo giá trị của trường khác.
Liên kết skill
https://github.com/webiny/webiny-js/blob/next/skills/user-skills/admin/form-model/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
“Xây dựng form Webiny có tiêu đề, ngày và trạng thái, trong đó trường ngày chỉ hiện khi trạng thái là đã lên lịch.”
5 skill mới mỗi tuần. Đọc chỉ 1 phút.
Cách hoạt động
Skill cho thấy cách định nghĩa trường bằng một trình tạo chuỗi, sắp xếp bằng trình tạo bố cục, và thêm kiểm tra hợp lệ hoặc quy tắc. Các trường cũng có thể phản ứng với giá trị của trường khác.
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.
Form Model
TL;DR
The Form Model is Webiny's declarative form system. Define fields with a fluent builder API (fields.text(), fields.datetime(), etc.), arrange them with a layout builder (layout.row(), layout.tabs(), etc.), and validate with Zod schemas or imperative rules. Fields support conditional visibility, computed values, reactive context from other fields (.context()), and deeply nested object/list structures with templates (dynamic zones).
Field Types
All fields are created via the fields registry callback. Each builder method returns a chainable builder.
Text
fields.text();
Default renderer: textInput. Value: string | null.
fields.text().label("Title").placeholder("Enter title").required("Title is required")
fields.text().renderer("textarea", { rows: 4 })
fields.text().list().renderer("tags").defaultValue([])
fields.text().list().renderer("textInputs", { addItemLabel: "Add text" })
fields.text().list().renderer("textareas", { addItemLabel: "Add description" })
fields.text().renderer("codeEditor", { language: "html", height: 300 })
fields.text().options([
{ label: "Option A", value: "a" },
{ label: "Option B", value: "b" }
]) // auto-switches to "select" renderer
fields.text().options([...]).renderer("radioButtons")
fields.text().list().options([...]).renderer("checkboxes")
// Dynamic options — callback receives { field, form }, re-evaluated reactively
fields.text().options(({ form }) => {
const type = form.field("general.type").getValue();
return getOptionsForType(type);
})
Number
fields.number();
Default renderer: numberInput. Value: number | null. Auto-normalizes to number.
fields.number().label("Count").placeholder("0").required();
fields.number().list().renderer("numberInputs", { addItemLabel: "Add number" });
fields.number().options([
{ label: "Tier 1", value: 100 },
{ label: "Tier 2", value: 200 }
]);
Boolean
fields.boolean();
Default renderer: switch. Value: boolean | null.
fields.boolean().label("Featured").defaultValue(false);
DateTime
fields.datetime();
Default renderer: dateTimeInput. Pick a variant method to set the subtype:
| Variant | Value Format | Example |
|---|---|---|
.dateOnly() |
"2026-05-01" |
Holidays, due dates (birthdays: see the birthday picker below) |
.timeOnly() |
"14:30:00" |
Opening hours |
.withTimezone() |
"2026-05-01T14:30:00+02:00" |
Events tied to a locale |
.withoutTimezone() |
"2026-05-01T14:30:00.000Z" |
Timestamps, logs |
.monthOnly() |
"2026-05" |
Billing cycles |
.weekOnly({ startsOn: 1 }) |
"2026-W18" |
Sprint planning |
.yearOnly({ range: [2020, 2035] }) |
2026 (number) |
Fiscal years |
.dateRange() |
{ from: "...", to: "..." } |
Vacation requests |
.multipleDates() |
["2026-05-01", "2026-05-03"] |
Blackout dates |
.multipleMonths() |
["2026-01", "2026-03"] |
Seasonal availability |
.multipleYears({ range: [2020, 2035] }) |
[2024, 2025, 2026] |
Multi-year budgets |
Additional chainable methods:
.presets([
{ label: "Today", value: () => new Date() },
{ label: "In a week", value: () => addDays(new Date(), 7) }
])
.displayFormat("dd/MM/yyyy") // date-fns format tokens
.list() // switches renderer to "dateTimeInputs"
.dateGte("2026-01-01", "message?") // value must
Câu hỏi thường gặp
Kiểm tra hợp lệ được thêm thế nào?
Skill hỗ trợ schema Zod cũng như các quy tắc mệnh lệnh đơn giản.
Các trường có thể phụ thuộc lẫn nhau không?
Có. Skill bao phủ hiển thị có điều kiện, vô hiệu hóa và các trường phản ứng với giá trị từ trường khác.
Trình render mặc định là gì?
Với trường văn bản, skill nói trình render mặc định là ô nhập văn bản, và nó có thể chuyển sang các trình render khác như vùng văn bản hoặc danh sách chọn.
Chi tiết
Mô tả gốc của tác giả
Building forms with the FormModel system — field types, renderers, layout, validation, conditional rules, computed fields, and dynamic zones. Use this skill when the developer needs to define form fields with the builder API, choose renderers, build layouts with tabs/rows/separators, add validation (Zod or imperative), use conditional visibility/disable rules, create computed fields, or work with object fields and templates (dynamic zones).
repo: webiny/webiny-js
Độ phổ biến
- Sao GitHub
- 8.1k
- Vị trí xếp hạng
- #12576
- 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-new-entry-wizard
8.1kDạy agent của bạn thêm một wizard thiết lập tùy chỉnh cho mục CMS mới của Webiny, thu thập vài trường trước rồi điền sẵn form mục.
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.