Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[EP-3941]: Add prop to Select to disable portalling #856

Closed
wants to merge 3 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions .changeset/little-crabs-provide.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"@igloo-ui/select": minor
---

Added the `disablePortal` prop to disable dropdown portal, positioning options absolutely instead
5 changes: 5 additions & 0 deletions packages/Select/src/Select.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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<SelectProps> = ({
Expand All @@ -72,6 +75,7 @@ const Select: React.FunctionComponent<SelectProps> = ({
options,
selectedOption,
showListIcon = true,
disablePortal = false,
...rest
}: SelectProps) => {
const results = React.useMemo(
Expand Down Expand Up @@ -290,6 +294,7 @@ const Select: React.FunctionComponent<SelectProps> = ({
className={selectDropdownClassname}
onClose={() => toggleMenu(true)}
isReferenceWidth={!autoWidth}
disablePortal={disablePortal}
isScrollable
>
<SelectInput isOpen={canShowMenu}>
Expand Down
Loading