Select left-checkmark option item variant, MultiSelect prop rename (WEB-1310)
Version: 0.9.0 · Type: ✨ Feature (⚠️ includes a breaking rename)
Problem
Single Select's combinatorial SelectContent/SelectItem (also reused by the declarative non-searchable options branch) always rendered the selected-state checkmark on the right, with no way to move it to the left. The Ghost trigger menu item Figma variant defaults to a left-aligned checkmark, and searchable single Select / MultiSelect already support left placement via SearchableOptionItem's variant — this combinatorial/declarative-non-searchable path was the one gap left, so a Ghost-trigger Select couldn't be paired with a left-checkmark menu.
Separately, MultiSelect's existing equivalent prop was named menuItemVariant — but a dropdown row is a SelectOptionItem, not a "menu item", so the name itself was wrong. This change renames it to optionItemVariant so Select and MultiSelect share one naming convention.
Changed Files
packages/design/src/components/Select/Select.tsxpackages/design/src/components/Select/MultiSelect.tsxpackages/design/src/components/Select/styles.tspackages/design/src/components/Select/__tests__/Select.test.tsxpackages/design/src/components/Select/__tests__/MultiSelect.test.tsxpackages/design/src/components/Select/SelectDesignSpec.mdpackages/design/src/components/Select/SelectTriggerGhostDesignSpec.mdpackages/design-site/docs/components/select.mdxpackages/design-site/i18n/zh-CN/docusaurus-plugin-content-docs/current/components/select.mdx
Changes
- Breaking:
MultiSelect.menuItemVariantis renamed tooptionItemVariant(same meaning, same accepted values, same default'checkmark'). Verified no consumer in this monorepo (apps/,web3/) references the old name. styles.ts: split the previously hard-coded right-sideSELECT_ITEM_TOKEN_CLASS/SELECT_ITEM_INDICATOR_TOKEN_CLASSintogetSelectItemTokenClass(variant)/getSelectItemIndicatorTokenClass(variant), dispatching on a newSelectOptionItemVariant('checkmark' | 'checkmark-right').checkmark-right(default) keeps the originalright-(--Spacing_16)position pluspr-[calc(var(--Spacing_16)+28px)]right-side reservation; the newcheckmarkusesleft-(--Spacing_16)pluspl-[calc(var(--Spacing_16)+28px)]left-side reservation.Select.tsx:optionItemVariantis not placed onSelectItemitself. It's added toSelectContent(default'checkmark-right', zero regression) and propagated via an internal context (SelectOptionItemVariantContext) to everySelectItemrendered inside it — every row in one dropdown must share the same checkmark placement (no Figma variant mixes left/right within a single menu), so a per-item prop would let a caller silently produce an inconsistent menu by forgetting it on one row.SelectPropsgains a matchingoptionItemVariantprop (default'checkmark-right'), threaded through the declarative non-searchable branch to theSelectContentit renders.- Tests:
Select.test.tsxgains 3 unit tests (default checkmark-right assertions,SelectContent optionItemVariant="checkmark"applying consistently to every item inside it, and declarativeoptionItemVariant="checkmark"pass-through);MultiSelect.test.tsxexisting tests updated to the renamed prop. - Docs site gains a left-checkmark demo (bilingual);
SelectDesignSpec.md/SelectTriggerGhostDesignSpec.mdupdated to record the breaking rename, the context-based design rationale, and check off the previously-open Ghost trigger menu item checklist item.
Impact
- Breaking:
MultiSelect.menuItemVariant→optionItemVariant. No consumer in this repo; any already-published version's external consumers need to rename accordingly. Select's newoptionItemVariantis purely additive;'checkmark-right'remains the default with unchanged output, so all existingSelectusage is visually and behaviorally unchanged.- Only affects the combinatorial
SelectContent/SelectItemand the declarative non-searchable branch —searchablesingle Select is unaffected (already covers left/right checkmark viaSearchableOptionItem).