Skip to content

Commit 581d6c1

Browse files
committed
Allow passing fullWidth so Option list width can be as larger as the content
1 parent f4b9f81 commit 581d6c1

1 file changed

Lines changed: 5 additions & 2 deletions

File tree

src/@next/Select/Select.tsx

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -65,6 +65,8 @@ export interface SelectProps {
6565
borderRadius?: string;
6666
required?: boolean;
6767
isPlaceholderFloating?: boolean;
68+
/** Allow popover to stretch to the full width of its activator */
69+
fullWidth?: boolean;
6870
}
6971

7072
export const Select = ({
@@ -103,6 +105,7 @@ export const Select = ({
103105
borderRadius,
104106
required,
105107
isPlaceholderFloating,
108+
fullWidth,
106109
}: SelectProps) => {
107110
const [internalPopoverActive, setInternalPopoverActive] = useState(false);
108111
const popoverActive =
@@ -284,7 +287,7 @@ export const Select = ({
284287
preventFocusOnClose
285288
preferredAlignment="left"
286289
preferredPosition="below"
287-
fullWidth
290+
fullWidth={fullWidth}
288291
fitContent={optionListFitContent}
289292
zIndexOverride={zIndexOverride}
290293
>
@@ -297,7 +300,7 @@ export const Select = ({
297300
onSelect={onSelect}
298301
sections={sections}
299302
selectedValues={selectedValues}
300-
width={width}
303+
width={fullWidth === false ? undefined : width}
301304
onMenuClose={handleClose}
302305
noOptionsMessage={
303306
optionsPlaceholderProps &&

0 commit comments

Comments
 (0)