Skip to content

Commit e89018c

Browse files
feat(Dropdown): support width prop on DropdownOverlay (#1825)
* Support width prop on ActionList / DropdownOverlay #1660 * fix: changed width type from string to BoxProps * Create pretty-wolves-deny.md --------- Co-authored-by: Saurabh Daware <saurabhdaware99@gmail.com>
1 parent 75c7ba6 commit e89018c

File tree

4 files changed

+10
-3
lines changed

4 files changed

+10
-3
lines changed

.changeset/pretty-wolves-deny.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
"@razorpay/blade": patch
3+
---
4+
5+
feat(Dropdown): Support `width` prop on DropdownOverlay

packages/blade/src/components/Dropdown/DropdownOverlay.web.tsx

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,7 @@ const _DropdownOverlay = ({
3333
children,
3434
testID,
3535
zIndex = OVERLAY_ZINDEX,
36+
width,
3637
}: DropdownOverlayProps): React.ReactElement | null => {
3738
const { isOpen, triggererRef, triggererWrapperRef, dropdownTriggerer, setIsOpen } = useDropdown();
3839
const { theme } = useTheme();
@@ -103,7 +104,7 @@ const _DropdownOverlay = ({
103104
isInBottomSheet={bottomSheetAndDropdownGlue?.dropdownHasBottomSheet}
104105
elevation={bottomSheetAndDropdownGlue?.dropdownHasBottomSheet ? undefined : 'midRaised'}
105106
style={{ ...styles }}
106-
width="100%"
107+
width={width ? width : '100%'}
107108
{...metaAttribute({ name: MetaConstants.DropdownOverlay, testID })}
108109
>
109110
{children}

packages/blade/src/components/Dropdown/docs/DropdownWithButton.stories.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -167,7 +167,7 @@ export const InternalAutoPositioning = (): React.ReactElement => {
167167
<Box display="inline-flex" position="fixed" left="spacing.5" top="spacing.5">
168168
<Dropdown>
169169
<DropdownButton>Top Left Menu</DropdownButton>
170-
<DropdownOverlay>
170+
<DropdownOverlay width="70%">
171171
<ActionList surfaceLevel={3}>
172172
<ActionListItem title="Apples" value="Apples" />
173173
<ActionListItem title="Appricots" value="Appricots" />

packages/blade/src/components/Dropdown/types.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import type React from 'react';
22
import type { StyledPropsBlade } from '~components/Box/styledProps';
33
import type { TestID } from '~utils/types';
4-
4+
import type { BoxProps } from '~components/Box';
55
type DropdownProps = {
66
/**
77
* Control open / close state of the Dropdown component
@@ -47,6 +47,7 @@ type DropdownOverlayProps = {
4747
* @default 1001
4848
*/
4949
zIndex?: number;
50+
width?: BoxProps['width'];
5051
} & TestID;
5152

5253
export type { DropdownProps, DropdownOverlayProps };

0 commit comments

Comments
 (0)