Skip to content

Commit 31e9394

Browse files
committed
Dropdown: Added scrollbar
1 parent d57085e commit 31e9394

File tree

1 file changed

+14
-0
lines changed

1 file changed

+14
-0
lines changed

client/packages/lowcoder-design/src/components/Dropdown.tsx

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ import { ReactNode } from "react";
66
import styled from "styled-components";
77
import { CustomSelect } from "./customSelect";
88
import { EllipsisTextCss } from "./Label";
9+
import { useEffect } from "react";
910
import { TacoMarkDown } from "./markdown";
1011
import { Tooltip, ToolTipLabel } from "./toolTip";
1112

@@ -157,6 +158,19 @@ interface DropdownProps<T extends OptionsType> extends Omit<SelectProps, "placem
157158
export function Dropdown<T extends OptionsType>(props: DropdownProps<T>) {
158159
const { placement = "right" } = props;
159160
const valueInfoMap = _.fromPairs(props.options.map((option) => [option.value, option]));
161+
162+
useEffect(() => {
163+
const dropdownElems = document.querySelectorAll<HTMLElement>("div.ant-dropdown ul.ant-dropdown-menu");
164+
for (let index = 0; index < dropdownElems.length; index++) {
165+
const element = dropdownElems[index];
166+
console.log(element);
167+
element.style.maxHeight = "300px";
168+
element.style.overflowY = "scroll";
169+
element.style.minWidth = "150px";
170+
element.style.paddingRight = "10px";
171+
}
172+
}, []);
173+
160174
return (
161175
<FlexDiv style={props.style} className={props.className}>
162176
{props.label && (

0 commit comments

Comments
 (0)