André Engelbrecht
André Engelbrecht

Reputation: 518

Render antd tree-select drop-down to left side

Does anyone know how to render an antd tree-select's drop-down to the left side?

I have a tree-select at the right edge of my page/screen. When the drop-down opens, part of it is rendered outside the screen because it renders "to the right"

Example

Is there a way to make it render to the left side where there is plenty of screen space?

Upvotes: 0

Views: 2116

Answers (1)

maktel
maktel

Reputation: 1372

I don't think there is a clean way to do it. However, if you can predict what data will be in the select and dropdown (and don't mind hardcoding some values...), I suggest you to try to fix width on ant-select and play with ant-select-dropdown by fixing its width and offset it by providing negative margin-left (using dropdownClassName prop of <TreeSelect />). You would have to test it for compatibility in multiple browsers.

example of using negative margin

Upvotes: 2

Related Questions