本文へスキップ
Skillpedia
WebサイトとUI(フロントエンド)8.1k · #12576

webiny-form-model

できること

このスキルは、Webinyプラットフォームでフォームを作るとき、AIを導きます。フィールド、レイアウト、検証を、わかりやすく宣言的な方法で定義したい開発者向けです。

使う場面

  • ✓ビルダーを使って、Webinyのフォームにテキストや日付などのフィールドを定義する必要があるとき。
  • ✓フォームのレイアウトに、タブ、行、区切りがほしいとき。
  • ✓他のフィールドの値によって、フィールドを表示、非表示、または検証させたいとき。

スキルのリンク

https://github.com/webiny/webiny-js/blob/next/skills/user-skills/admin/form-model/SKILL.md

コピーしてAI(Claude、ChatGPT、Cursor)に貼り付け、指示に従うよう頼んでください。

使い方

いちばん簡単な方法:メッセージをコピーしてAIに貼り付けるだけ。AIがスキルを読んで指示に従います。

貼り付け用メッセージ

このスキルを使って手伝ってください:https://github.com/webiny/webiny-js/blob/next/skills/user-skills/admin/form-model/SKILL.md このリンクのSKILL.mdファイルを読んで、私の作業でその指示に従ってください。
こういうスキルを、AIが自分で見つけてくれたら?無料のSkillpedia MCPをインストール。1行で、作業の前に15,000+のスキルから探してくれます。1分でインストール →

AIへの頼み方の例

“タイトル、日付、ステータスを持つWebinyのフォームを作ってください。日付のフィールドは、ステータスが予約済みのときだけ表示されるようにしてください。”

毎週5つの新しいスキル。1分で読めます。

仕組み

スキルは、連鎖可能なビルダーでフィールドを定義し、レイアウトのビルダーで配置し、検証やルールを加える方法を示します。フィールドは、他のフィールドの値にも反応できます。

技術的な内容(元のSKILL.md)

作者による元のテキスト(英語)をGitHubからそのまま表示しています。

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
よくある質問

検証はどのように追加されますか?

スキルは、単純な命令的なルールだけでなく、Zodのスキーマにも対応しています。

フィールドは互いに依存できますか?

はい。スキルは、条件付きの表示、無効化、他の値に反応するフィールドを扱います。

テキストのフィールドに、デフォルトでどのレンダラーが使われますか?

スキルによると、テキストのフィールドの既定のレンダラーはテキスト入力で、テキストエリアや選択などの他のレンダラーに切り替えることもできます。

詳細

作者による元の説明

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

人気

GitHubのスター
8.1k
ランキング
#12576
ライセンス
—
更新日
2026/11/2

このスキルは役に立ちますか?

0

ログイン して投票しましょう。

コメント

  • …

このリポジトリの他のスキル

似ているスキル