Skip to content

[WidgetPicker] Add opt-in tenant brand header preset - #1898

Open
victrvondoom wants to merge 1 commit into
layer5io:masterfrom
victrvondoom:victrvondoom-widgetpicker-brand-header-preset
Open

victrvondoom wants to merge 1 commit into
layer5io:masterfrom
victrvondoom:victrvondoom-widgetpicker-brand-header-preset

Conversation

@victrvondoom

@victrvondoom victrvondoom commented Nov 19, 2026 •

Copy link
Copy Markdown

Notes for Reviewers

This PR fixes #1844.

  • Adds an opt-in brand value for WidgetPicker's headerPreset, resolving background.brand.default before primary.main and pairing it with text.inverse.
  • Keeps the existing neutral background.default / text.primary treatment as the default. Existing headerBackgroundColor and headerTextColor remain supported and override either preset.
  • Adds light/dark behavioral tests, tenant palette and fallback coverage, explicit override assertions, and WidgetPicker stories showing the neutral default and branded opt-in.

Validation

  • npm run lint — passed.
  • npm test -- --runInBand — passed (39 suites, 667 tests).
  • $env:NODE_ENV = 'production'; npx tsup — passed, including declaration build. npm run build uses Unix-only environment syntax and does not run directly in PowerShell.
  • npx prettier --check src/custom/WidgetPicker/WidgetPicker.tsx src/custom/WidgetPicker/index.tsx src/custom/WidgetPicker/WidgetPicker.stories.tsx src/__testing__/WidgetPicker.test.tsx src/index.tsx --config ./.prettierrc — passed.
  • npm run format:check — reports pre-existing formatting issues elsewhere in the repository.
  • The configured no-mistakes pipeline could not be run: the available no-mistakes executable is a different static-analysis CLI and does not provide the axi command. The required no-mistakes PR check may therefore remain blocked.

Signed commits

  • Yes, I signed my commits.

Summary by CodeRabbit

  • New Features
    • Widget picker headers can now use either the default or tenant-brand color preset. The brand preset uses the available brand background and inverse text colors, with a primary-color fallback when no brand background is set.
    • Custom header background and text colors can override the selected preset. The close icon matches the resolved header text color.

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Signed-off-by: vsrupeshkumar <vsrupeshkumar@users.noreply.github.com>
@coderabbitai

coderabbitai Bot commented Nov 19, 2026 •

Copy link
Copy Markdown
Contributor

Explain Change →

No actionable comments were generated in the recent review.

Walkthrough

WidgetPicker adds a default or brand header preset. Custom header colors override the preset colors. The preset type is re-exported, and tests and Storybook stories cover the available color treatments.

Changes: WidgetPicker header presets

Layer / File(s) Summary
Define, render, and validate header presets
src/custom/WidgetPicker/WidgetPicker.tsx, src/custom/WidgetPicker/index.tsx, src/index.tsx, src/__testing__/WidgetPicker.test.tsx, src/custom/WidgetPicker/WidgetPicker.stories.tsx
The header defaults to the default preset. The brand preset uses background.brand.default or falls back to primary.main, with text.inverse. Explicit header colors override the selected preset, and the resolved text color applies to the close icon. The preset type is re-exported. Tests cover light and dark themes, fallback behavior, and color overrides. Storybook adds light, dark, and tenant-brand examples.

Estimated code review effort: 2 (Simple) | ~10 minutes

Change: Feature

Suggested reviewers: nstkrishna

Merge Risk: Minimal · up to 10549

This adds an optional brand header preset to WidgetPicker and leaves existing behavior unchanged by default. No merge-blocking risk was identified.

Pre-merge checks: Passed 4

Check name Status Explanation
Title check Passed The title names the main change: an opt-in tenant brand header preset for the WidgetPicker component. The changeset adds a headerPreset prop with 'default' and 'brand' values, the brand-preset logic (…
Linked Issues check Passed Issue #1844 is a design question. It asks whether the WidgetPicker header default should be branded. It does not require a specific default. The PR keeps the neutral default and adds an opt-in path. A…
Out of Scope Changes check Passed All changed areas relate to the headerPreset objective of #1844. WidgetPicker.tsx adds the preset type and prop and the header color resolution. The test file covers the new preset behavior and overri…
Description Check Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Full details: Title check

Explanation

The title names the main change: an opt-in tenant brand header preset for the WidgetPicker component. The changeset adds a headerPreset prop with 'default' and 'brand' values, the brand-preset logic (background.brand.default falling back to primary.main, paired with text.inverse), tests, and stories. The title is specific, concise, and matches the linked objectives. It uses the bracketed component prefix, which is a common convention and does not reduce clarity.

Full details: Linked Issues check

Explanation

Issue #1844 is a design question. It asks whether the WidgetPicker header default should be branded. It does not require a specific default. The PR keeps the neutral default and adds an opt-in path. At head, WidgetPicker.tsx adds headerPreset ('default' | 'brand'), defaulting to 'default'. The 'brand' preset resolves background.brand.default ?? primary.main with text.inverse. The defaults are kept as background.default and text.primary. headerBackgroundColor and headerTextColor override either preset. The issue asks that the default be documented in the component. The JSDoc on headerPreset states the default and the brand behavior, which meets that request. Tests in src/testing/WidgetPicker.test.tsx cover light and dark defaults, brand resolution, primary.main fallback, and explicit overrides. The PR description states that the docs gap is not present, but the JSDoc in code covers it. Whether the neutral default is the intended design remains a maintainer decision. This assessment does not decide that question.

Full details: Out of Scope Changes check

Explanation

All changed areas relate to the headerPreset objective of #1844. WidgetPicker.tsx adds the preset type and prop and the header color resolution. The test file covers the new preset behavior and overrides. The stories file adds the neutral default and branded opt-in examples for the same component. index.tsx and src/index.tsx export the new WidgetPickerHeaderPreset type so consumers can use the prop type. The summary reports import reordering and formatting changes in WidgetPicker.tsx. These support the same component change and do not add unrelated behavior. The diff tool could not read changed blobs, so this assessment uses the file at head and the supplied PR summary.

Finishing Touches

Generate unit tests (beta)

  • Create a new PR
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

Share

Recent review info

Run configuration

  • Source mode: Auto
  • Repository: Unavailable
  • Branch: Unavailable
  • File: No configuration file from this repository applied
  • Commit: Unavailable
  • Layers: defaults
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: c037a25b-429b-4ad1-afbe-20abeef115fb
Commits

Reviewing files that changed from the base of the PR and between cc8f5db and 10549fd.

Files selected for processing: 5

  • src/__testing__/WidgetPicker.test.tsx
  • src/custom/WidgetPicker/WidgetPicker.stories.tsx
  • src/custom/WidgetPicker/WidgetPicker.tsx
  • src/custom/WidgetPicker/index.tsx
  • src/index.tsx

Included review availability: This review used your included allowance. Your plan provides up to 2 included reviews per hour; 1 remain after this review.

@suttonskate suttonskate left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Approved, nice work. This implements approach 2 from #1844 exactly as fitzergerald chose it: the neutral background.default / text.primary default stays untouched, and tenant branding is an opt-in headerPreset="brand" that resolves background.brand.default with a primary.main fallback and text.inverse. Explicit headerBackgroundColor / headerTextColor still override the preset, and the close icon follows the resolved text color. Tests cover the default and brand preset in light and dark mode, the primary.main fallback, and the explicit overrides, plus stories for both treatments. DCO signed, no conflicts. One note: CodeRabbit is still running, so I am leaving the merge to a later pass once its review lands.

@miacycle

Copy link
Copy Markdown
Contributor

Good work! You might like to present your work in the upcoming, weekly Meshery development meeting (meshery.io/calendar). If so, I encourage you to add this item in the meeting agenda (https://meet.meshery.io/dev-minutes), attend, present, and receive feedback.

This branch has not been deployed

No deployments
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.

Should WidgetPicker's header default to a brand fill, so consumers get tenant branding without passing headerBackgroundColor/headerTextColor?

3 participants