Skip to content

How do you change the width? #92

Answered by csandman
bubblydevs asked this question in Q&A
Discussion options

You must be logged in to vote

Sure, there are two easy ways you could do this. The first is by setting a width on the container using the chakraStyles prop:

<Select
  chakraStyles={{
    container: (provided) => ({
      ...provided,
      width: "300px"
    })
  }}
/>

The second would be to just add a container around the Select with a manual width set on that.

<Box w="250px">
  <Select />
</Box>

Here's a CodeSandbox example with both: https://codesandbox.io/s/chakra-react-select-custom-width-8h04ww?file=/example.js


Let me know if either of these works for you!

Replies: 1 comment 2 replies

Comment options

You must be logged in to vote
2 replies
@bubblydevs
Comment options

@csandman
Comment options

Answer selected by bubblydevs
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants