Skip to content

Commit 7a0a723

Browse files
committed
fix(components): add select parameter to fit content
1 parent 69437d7 commit 7a0a723

File tree

1 file changed

+9
-0
lines changed
  • packages/components/src/components/form/Select

1 file changed

+9
-0
lines changed

packages/components/src/components/form/Select/Select.tsx

+9
Original file line numberDiff line numberDiff line change
@@ -116,6 +116,7 @@ type WrapperProps = TransientProps<
116116
$isWithPlaceholder: boolean;
117117
$elevation: Elevation;
118118
$isLoading?: boolean;
119+
$menuFitContent?: boolean;
119120
};
120121

121122
const SelectWrapper = styled.div<WrapperProps>`
@@ -230,6 +231,11 @@ const SelectWrapper = styled.div<WrapperProps>`
230231
${menuStyle}
231232
border: none;
232233
z-index: ${zIndices.base};
234+
${({ $menuFitContent }) =>
235+
$menuFitContent &&
236+
css`
237+
width: fit-content;
238+
`}
233239
}
234240
235241
${({ $isDisabled }) =>
@@ -276,6 +282,7 @@ export type SelectProps = KeyPressScrollProps &
276282
label?: ReactNode;
277283
size?: InputSize;
278284
minValueWidth?: string;
285+
menuFitContent?: boolean;
279286
isMenuOpen?: boolean;
280287
isLoading?: boolean;
281288
onChange?: (value: Option, ref?: SelectInstance<Option, boolean> | null) => void;
@@ -289,6 +296,7 @@ export const Select = ({
289296
useKeyPressScroll,
290297
isSearchable = false,
291298
minValueWidth = 'initial',
299+
menuFitContent,
292300
isMenuOpen,
293301
components,
294302
onChange,
@@ -348,6 +356,7 @@ export const Select = ({
348356
$isSearchable={isSearchable}
349357
$size={size}
350358
$minValueWidth={minValueWidth}
359+
$menuFitContent={menuFitContent}
351360
$isDisabled={isDisabled}
352361
$isLoading={isLoading}
353362
$isMenuOpen={isMenuOpen}

0 commit comments

Comments
 (0)