Skip to content

feat(picker): expose per-item invalid state#4029

Open
TommyLindh2 wants to merge 4 commits intomainfrom
feat/4028-picker-per-item-invalid
Open

feat(picker): expose per-item invalid state#4029
TommyLindh2 wants to merge 4 commits intomainfrom
feat/4028-picker-per-item-invalid

Conversation

@TommyLindh2
Copy link
Copy Markdown
Contributor

Closes #4028
Stacked on #4027

Summary

  • Add an optional invalid field to the ListItem interface
  • Forward listItem.invalid through limel-picker's createChip to the rendered chip
  • Add a limel-example-picker-invalid-items example

Consumers can now flag individual selections in a multi-value picker as invalid:

```ts
selectedItems = [
{ text: 'Ayla', value: 2 },
{ text: 'Clunk', value: 3, invalid: true },
{ text: 'Coco', value: 4 },
];
```

Scope note

The invalid flag on ListItem is currently only honoured when the item is rendered as a chip (i.e., inside limel-picker). Plain lists and menus ignore it today — extending the visualization to those surfaces is a follow-up design discussion (tracked separately).

Dependencies

Depends on #4027 — the chip-set needs to forward per-chip invalid before this is useful end-to-end. Merge #4027 first, then rebase this branch onto main before merging.

Test plan

  • npm run build passes
  • npm run lint passes
  • npm run test — all 1119 tests pass
  • Manual: open the new limel-example-picker-invalid-items example and confirm the pre-selected "Clunk" chip renders with the invalid styling while the others render normally
  • Manual: pick "Derpl" (also marked invalid in allItems) and confirm it too renders as invalid once selected

@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai Bot commented Apr 15, 2026

Important

Review skipped

Auto reviews are disabled on base/target branches other than the default branch.

Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: ASSERTIVE

Plan: Pro

Run ID: e7a31bbe-40a3-49b7-b61c-621c7c6c5490

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • 🔍 Trigger review
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch feat/4028-picker-per-item-invalid

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

Comment @coderabbitai help to get the list of available commands and usage tips.

@github-actions
Copy link
Copy Markdown

Documentation has been published to https://lundalogik.github.io/lime-elements/versions/PR-4029/

Add an optional `invalid` field to the `Chip` interface and pass it
through `getChipProps` so consumers can mark individual chips in the
`value` array as invalid. This is independent of the chip-set-level
`invalid` prop, which continues to mark the whole field as invalid.

Closes #4026
Demonstrate the new per-chip `invalid` flag with an email recipients
input: entries that don't look like email addresses are rendered with
`invalid: true` and an error icon.
@TommyLindh2 TommyLindh2 force-pushed the feat/4026-chip-set-per-chip-invalid branch from 984451f to c8a0105 Compare April 15, 2026 10:07
Add an optional `invalid` field to the `ListItem` interface and pass it
through the picker's `createChip`, so consumers can mark individual
selections in the `value` array as invalid — useful when a previously
valid selection is no longer valid (e.g. a deactivated user).

This is independent of the picker-level `invalid` prop, which marks the
whole field as invalid. The flag is currently only honoured when the
item is rendered as a chip; plain lists and menus ignore it.

Closes #4028
Demonstrate marking selected list items as invalid by pre-selecting
three members where one is flagged `invalid: true`, rendering it with
the chip's invalid styling while the other two render normally.
@TommyLindh2 TommyLindh2 force-pushed the feat/4028-picker-per-item-invalid branch from 4d5d22a to a491c96 Compare April 15, 2026 10:09
@TommyLindh2 TommyLindh2 requested a review from a team as a code owner April 15, 2026 10:09
@TommyLindh2 TommyLindh2 linked an issue Apr 15, 2026 that may be closed by this pull request
@TommyLindh2 TommyLindh2 force-pushed the feat/4026-chip-set-per-chip-invalid branch 3 times, most recently from f79e5c8 to 30e50be Compare May 4, 2026 09:23
Base automatically changed from feat/4026-chip-set-per-chip-invalid to main May 4, 2026 09:37
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.

picker: expose invalid state per list item

1 participant