Skip to content
Open
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/select-panel-display-in-viewport.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'@primer/react': minor
---

SelectPanel: Add `displayInViewport` prop
6 changes: 6 additions & 0 deletions packages/react/src/SelectPanel/SelectPanel.docs.json
Original file line number Diff line number Diff line change
Expand Up @@ -237,6 +237,12 @@
"type": "boolean",
"defaultValue": "false",
"description": "If true, enables client-side list virtualization. Only the visible items plus a small overscan buffer are rendered in the DOM, dramatically improving performance for large lists. Recommended for lists with more than 100 items. Has no effect when `groupMetadata` is provided."
},
{
"name": "displayInViewport",
"type": "boolean",
"defaultValue": "false",
"description": "If true, the panel will attempt to fit entirely into the visible viewport, without having to scroll."
}
],
"subcomponents": []
Expand Down
4 changes: 3 additions & 1 deletion packages/react/src/SelectPanel/SelectPanel.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -131,7 +131,7 @@ type SelectPanelVariantProps = {variant?: 'anchored'; onCancel?: () => void} | {

export type SelectPanelProps = SelectPanelBaseProps &
Omit<FilteredActionListProps, 'selectionVariant' | 'variant' | 'message'> &
Pick<AnchoredOverlayProps, 'open' | 'height' | 'width' | 'align'> &
Pick<AnchoredOverlayProps, 'open' | 'height' | 'width' | 'align' | 'displayInViewport'> &
AnchoredOverlayWrapperAnchorProps &
(SelectPanelSingleSelection | SelectPanelMultiSelection) &
SelectPanelVariantProps
Expand Down Expand Up @@ -203,6 +203,7 @@ function Panel({
showSelectAll = false,
focusPrependedElements,
virtualized,
displayInViewport,
...listProps
}: SelectPanelProps): JSX.Element {
const titleId = useId()
Expand Down Expand Up @@ -876,6 +877,7 @@ function Panel({
className={classes.Overlay}
displayCloseButton={showXCloseIcon}
closeButtonProps={closeButtonProps}
displayInViewport={displayInViewport}
>
<div className={classes.Wrapper} data-variant={variant}>
<div className={classes.Header} data-variant={currentResponsiveVariant}>
Expand Down
Loading