Skip to content

feat(next, ui): widget fields#15730

Closed
Copilot wants to merge 14 commits intomainfrom
copilot/sub-pr-15700
Closed

feat(next, ui): widget fields#15730
Copilot wants to merge 14 commits intomainfrom
copilot/sub-pr-15700

Conversation

Copy link
Copy Markdown
Contributor

Copilot AI commented Feb 23, 2026

Adds configurable fields support to dashboard widgets — widgets can now declare a field schema (analogous to Blocks), with data editable via a drawer UI when in dashboard editing mode.

Changes

  • ConfigWidget type gains an optional fields: Field[] array; sanitizeConfig sanitizes widget fields the same way collection/global fields are sanitized
  • Type generationconfigToJSONSchema emits per-widget data schemas derived from fields; width type is narrowed to the allowed range based on minWidth/maxWidth constraints
  • Typed exports — new TypedWidget, WidgetSlug, DataFromWidgetSlug types added to packages/payload/src/index.ts; WidgetInstance<TSlug> is now generic with typed data and constrained width
  • WidgetServerProps<T> — generic parameter narrows both widgetData and widgetSlug for a given widget type
  • UIWidgetConfigDrawer renders a Form over the widget's fields; edit control hidden when widget has no fields; drawer saves data back into layout state
  • buildFieldSchemaMap — widget fields included so Lexical/RSC field resolvers work inside widget field editors
  • Docsdocs/custom-components/dashboard.mdx updated with field usage example

Example

// payload.config.ts
widgets: [
  {
    slug: 'sales-summary',
    ComponentPath: './components/SalesSummary.tsx#default',
    fields: [
      { name: 'title', type: 'text' },
      { name: 'timeframe', type: 'select', options: ['daily', 'weekly', 'monthly', 'yearly'] },
    ],
    minWidth: 'small',
    maxWidth: 'medium',
  },
]
// SalesSummary.tsx
import type { WidgetServerProps } from 'payload'
import type { SalesSummaryWidget } from '../payload-types'

export default function SalesSummaryWidget({ widgetData }: WidgetServerProps<SalesSummaryWidget>) {
  const title = widgetData?.title ?? 'Sales Summary'
  // widgetData is fully typed from the generated payload-types
}

🔒 GitHub Advanced Security automatically protects Copilot coding agent pull requests. You can protect all pull requests by enabling Advanced Security for your repositories. Learn more about Advanced Security.

Copilot AI changed the title [WIP] Add fields support to dashboard widgets feat(next, ui): widget fields Feb 23, 2026
Copilot AI requested a review from GermanJablo February 23, 2026 16:31
Base automatically changed from feat/widget-fields to main February 25, 2026 13:33
@GermanJablo GermanJablo deleted the copilot/sub-pr-15700 branch February 26, 2026 11:42
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants