Sizing issues #201
-
Hello, Thank you for creating chakra-react-select. I have tried using it today, however right out of the box I have noticed some sizing differences when compared to the traditional Chakra's Select. Here is an example: Element 1. is the Chakra's original select input (no react-select plugged in) and 2. is chakra-react-select. Neither of them contain any additional styles, they are completely raw. Could you kindly tell me how can I bring the chakra-react-select component (2.) to look like the Chakra's original select input (1.), please? Thank you very much |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 3 replies
-
EDIT: Here's my real answer: NOTE: There was one issue I noticed (#202) while making this example, a default style from Chakra's theme that was causing the Ah ok, I see what your problem is then! Well, both problems actually.
Here's an example of what yours would look like if your last column had the largest content: The easiest fix for this is to use the <Table sx={{ tableLayout: "fixed" }}>
<Select
chakraStyles={{
container: (provided) => ({
...provided,
textTransform: "none",
fontWeight: "normal",
letterSpacing: "normal",
fontFamily: "body",
lineHeight: "base",
}),
}}
/> This did however bring up a question for me though- should these props be reset by default on this container? I'm not sure if that would be the expected behavior for most users, but it could be. Also, it's possible that some users are relying on these styles to be inherited so adding these defaults could be a breaking change for some. I'm going to leave it as is for now while I think about it more but in the mean time, it's easy enough to override these styles using this strategy. Here's an example of what I think you want the whole thing to look like: https://codesandbox.io/s/chakra-react-select-horizontal-layout-in-a-table-kh22eq?file=/example.js Sure I can help with that, but I need a bit more info on the structure of your components to really help you accurately. It's possible just adding <Select
chakraStyles={{
container: (provided) => ({ ...provided, width: "100%" }),
}}
/> This worked in an example I tried because they're all just wrapped in one parent If that doesn't do the trick then I'd need a minimal reproduction of how your components are set up to do any more. You can make one of those with one of the provided templates: https://codesandbox.io/s/chakra-react-select-vsvr0?file=/example.js |
Beta Was this translation helpful? Give feedback.
EDIT: Here's my real answer:
NOTE: There was one issue I noticed (#202) while making this example, a default style from Chakra's theme that was causing the
MenuList
to be cut off at the end if it was below a certain width. You should update tov4.2.6
to avoid this issue!Ah ok, I see what your problem is then! Well, both problems actually.
Select
get's shrunk.Here's…