diff --git a/.changeset/little-crabs-provide.md b/.changeset/little-crabs-provide.md new file mode 100644 index 00000000..beb7617e --- /dev/null +++ b/.changeset/little-crabs-provide.md @@ -0,0 +1,5 @@ +--- +"@igloo-ui/select": minor +--- + +Added the `disablePortal` prop to disable dropdown portal, positioning options absolutely instead diff --git a/packages/Select/src/Select.tsx b/packages/Select/src/Select.tsx index 8d22a2ac..69db3f95 100644 --- a/packages/Select/src/Select.tsx +++ b/packages/Select/src/Select.tsx @@ -55,6 +55,9 @@ export interface SelectProps { /** Whether or not to show the icon inside the * dropdown list if it's available */ showListIcon?: boolean; + /** Disables the component from appending the dropdown + * to the end of the body using ReactPortal */ + disablePortal?: boolean; } const Select: React.FunctionComponent = ({ @@ -72,6 +75,7 @@ const Select: React.FunctionComponent = ({ options, selectedOption, showListIcon = true, + disablePortal = false, ...rest }: SelectProps) => { const results = React.useMemo( @@ -290,6 +294,7 @@ const Select: React.FunctionComponent = ({ className={selectDropdownClassname} onClose={() => toggleMenu(true)} isReferenceWidth={!autoWidth} + disablePortal={disablePortal} isScrollable >