Select ghost trigger variant (WEB-1277)
Version: 0.9.0 · Type: ✨ Feature
Problem
Select only shipped one trigger form — the form-style (outline) trigger: bordered, w-full, left-aligned value. Inline / toolbar / low-emphasis selection scenarios (e.g. an in-line "by week / by month" switcher) need a borderless, content-width, right-aligned compact trigger, which was not expressible.
Changed Files
packages/design/src/components/Select/styles.tspackages/design/src/components/Select/Select.tsxpackages/design/src/components/ui/select.tsxpackages/design/src/components/Select/__tests__/Select.test.tsxpackages/design-site/src/icons/plaud-icon-registry.tsx(SortIcon neutral-statecurrentColor)packages/design-site/docs/components/select.mdx(block-level flow example)packages/design-site/i18n/zh-CN/docusaurus-plugin-content-docs/current/components/select.mdx
Changes
Select/SelectTriggergain avariantprop ('outline' | 'ghost'), defaulting to'outline'— existing usage is unchanged.variant="ghost"renders a borderless, content-width, right-aligned trigger with a trailing sort (up/down) arrow and a grayGrays/Gray-1background on hover / open; text color isLabels/Tertiary, dimming toLabels/Disabledwhen disabled.ui/select.tsxSelectTriggergains an optionaliconprop to override the defaultChevronDownIcon(internal capability passthrough); default behavior is unchanged wheniconis omitted.SortIconneutral state (sortDirection === null) now renders withcurrentColorinstead of a hard-codedLabels/Tertiary, so the icon follows its parent text color — this lets the ghost disabled state dim the arrow correctly. Theasc/descactive-highlight logic is unchanged.- Fixed a width bug: the ghost base class only overrode width (
w-full→w-auto) but notdisplay. The underlyingui/select.tsxprimitive is a block-levelflexcontainer, sowidth: autoalone still stretched to fill the parent width outside a flex/grid parent, making the hover/focus gray background span the full line. Addedinline-flexalongsidew-autoso the trigger truly shrink-to-fits its content in any layout context.
Impact
- New API only;
variantdefaults to'outline', so all existingSelectusage is visually and behaviorally unchanged. - The dropdown panel and menu items are fully reused from the existing
SelectContent—ghostonly changes the trigger. - The
SortIconneutral-state change was verified against every neutral-state consumer (Table / TimePicker / Calendar / routine selects); all resolve toLabels/Tertiaryor the hex-identicalLabels/Placeholder, so there is no visual regression.