Repository navigation
feat(multiselector): formatTriggerCount prop for custom count trigger text (proposal for #3348) - #3354
Merged
thedjpetersen merged 2 commits intoSep 19, 2026
Conversation
… text
Adds an optional formatTriggerCount?: (count: number) => string prop to
MultiSelector. When triggerDisplay='count' (the default), the trigger text
is formatTriggerCount?.(count) ?? `${count} selected` — default behavior
unchanged; labels/badges modes untouched.
Implements the arbitration winner from #3348.
(pre-commit run manually: eslint + prettier on changed files, pnpm check:repo —
npx lint-staged unavailable offline)
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
Contributor
PR Analysis Report📚 Storybook PreviewView Storybook for this PR 🧪 Sandbox PreviewView Sandbox for this PR No new or modified components detected. Bundle Size Summary
Accessibility AuditStatus: No accessibility violations detected. Generated by PR Enrichment workflow | Storybook | Sandbox | View full report |
cixzhang
reviewed
Jul 8, 2026
| * ``` | ||
| * @default (count) => `${count} selected` | ||
| */ | ||
| formatTriggerCount?: (count: number) => string; |
Contributor
There was a problem hiding this comment.
Internally, we have this prop
getButtonLabelFromValue
(?ReadonlyArray<TValue>) => string
Customize how we create the button label from values. Also used for providing an accessible label that won't be displayed on the screen. - Must return a non-empty string. - If you want to hide the button label, set isButtonLabelHidden. - By default, we render the value's label if there's only one, otherwise we show "# items".
It's a bit wordy and I don't really like that we called these "buttons" since they're really not buttons. I do think we need a better pattern.
github-actions
Bot
requested review from
cvkxx,
ernestt,
kentonquatman and
rubyycheung
July 12, 2026 03:29
…ctor-format-trigger-count # Conflicts: # packages/core/src/MultiSelector/MultiSelector.doc.mjs # packages/core/src/MultiSelector/MultiSelector.test.tsx # packages/core/src/MultiSelector/MultiSelector.tsx
thedjpetersen
marked this pull request as ready for review
September 19, 2026 04:22
thedjpetersen
requested review from
imdreamrunner and
josephfarina
as code owners
September 19, 2026 04:23
github-actions
Bot
deleted the
claude/feat/multiselector-format-trigger-count
branch
September 19, 2026 06:20
3 tasks done
3 tasks done
This branch was successfully deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What
Adds
formatTriggerCount?: (count: number) => stringtoMultiSelector.'count'branch, the text is nowformatTriggerCount?.(count) ??${count} selected``.triggerDisplay='count'(the default).labelsandbadgesmodes are untouched.triggerDisplaydocs updated to point at it.MultiSelector.doc.mjsupdated (props table, dense + zh translations,triggerDisplaydescription).MultiSelectorColumnVisibilitySelectorCLI showcase block (alreadytriggerDisplay="count"with a hidden label) now demonstrates the prop with "N columns shown".@astryxdesign/core+@astryxdesign/cli, patch (pre-1.0 patch-only).Why
The
'count'trigger text was hard-coded${count} selected. A builder using Astryx for an internal tool (Meridian) needed "3 spaces selected" with no visible label, found no prop, and rebuilt the control from Popover + CheckboxInput — the highest-cost failure mode for the system.renderOptionalready establishes function-prop customization on this exact component; the count text is presentation, not data.API arbitration (from #3348, compact round, 2026-07-01 — naive sonnet generations + haiku hallucination probe):
formatTriggerCountfnitemNounstringtriggerContentrender-fnTesting
MultiSelector.test.tsx: 43 tests pass (40 existing + 3 new — custom formatter renders "2 spaces selected", default "1 selected" unchanged without the prop, formatter is ignored inlabelsmode).@astryxdesign/coretypecheck clean; eslint + prettier clean on changed files;pnpm check:repo(changesets, sync, package boundaries, demo media) passes.derivedVarRegistry.test.tsreproduces on a clean tree (verified via stash).Open questions
itemNounrunner-up: should a string convenience prop also exist for the 90% case (itemNoun="space"→ "3 spaces selected"), layered on top of the formatter?(count, labels) => string), or is thatlabelsmode's job?