Skip to content

Control extends horizontally when lots of text is typed into the input #5472

@peeveen

Description

@peeveen

Hi,
First of all, thanks for making this control.

I've been using it in my app, and it's working well apart from one thing that I can't seem to figure out.
If I type a lot of text into the input, it makes the control extend horizontally.
The only way I can figure out how to stop that happening is to apply an absolute maxWidth style to the control, but that's far from ideal.
Here's my test app (from a simple test made with create-react-app):

import Select from "react-select"
import "./App.css"
function App() {
	const options = [
		{ value: "chocolate", label: "Chocolate" },
		{ value: "strawberry", label: "Strawberry" },
		{ value: "vanilla", label: "Vanilla" },
	]

	return (
		<div
			style={{
				backgroundColor: "purple",
				padding: 50,
			}}
		>
			<div
				style={{
					backgroundColor: "default",
					padding: 10,
					flex: 1,
					display: "flex",
					flexWrap: "nowrap",
					flexDirection: "row",
				}}
			>
				<div
					style={{
						display: "flex",
						justifyContent: "center",
						alignItems: "center",
						flex: 0.2,
					}}
				>
					CHOOSE:
				</div>
				<div
					style={{
						display: "flex",
						flex: 0.8,
					}}
				>
					<Select
						options={options}
						styles={{
							container: (styles) => ({
								...styles,
								display: "flex",
								flex: 1,
							}),
							control: (styles) => ({
								...styles,
								//maxWidth: "500px",
								display: "flex",
								flex: 1,
							}),
						}}
					/>
				</div>
			</div>
		</div>
	)
}

export default App

Metadata

Metadata

Assignees

No one assigned

    Labels

    issue/bug-unconfirmedIssues that describe a bug that hasn't been confirmed by a maintainer yet

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions