Skip to content

Commit 94bc4e1

Browse files
authored
Merge incoming style prop on ComboboxOptions, ListboxOptions, MenuItems, and PopoverPanel components (#3250)
* merge incoming `style` prop We were overriding the `style` prop entirely on the `<ComboboxOptions>`, `<ListboxOptions>`, `<MenuItems>`, and `<PopoverPanel>` for anchoring purposes, as well as provided some CSS variables. This now ensures that the incoming `style` prop gets merged in. * update changelog
1 parent 7267cc4 commit 94bc4e1

File tree

5 files changed

+5
-0
lines changed

5 files changed

+5
-0
lines changed

packages/@headlessui-react/CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
1414
### Fixed
1515

1616
- Keep `<Combobox />` open when clicking scrollbar in `<ComboboxOptions>` ([#3249](https://github.com/tailwindlabs/headlessui/pull/3249))
17+
- Merge incoming `style` prop on `ComboboxOptions`, `ListboxOptions`, `MenuItems`, and `PopoverPanel` components ([#3250](https://github.com/tailwindlabs/headlessui/pull/3250))
1718

1819
## [2.0.4] - 2024-05-25
1920

packages/@headlessui-react/src/components/combobox/combobox.tsx

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1695,6 +1695,7 @@ function OptionsFn<TTag extends ElementType = typeof DEFAULT_OPTIONS_TAG>(
16951695
id,
16961696
ref: optionsRef,
16971697
style: {
1698+
...theirProps.style,
16981699
...style,
16991700
'--input-width': useElementSize(data.inputRef, true).width,
17001701
'--button-width': useElementSize(data.buttonRef, true).width,

packages/@headlessui-react/src/components/listbox/listbox.tsx

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1095,6 +1095,7 @@ function OptionsFn<TTag extends ElementType = typeof DEFAULT_OPTIONS_TAG>(
10951095
role: 'listbox',
10961096
tabIndex: 0,
10971097
style: {
1098+
...theirProps.style,
10981099
...style,
10991100
'--button-width': useElementSize(data.buttonRef, true).width,
11001101
} as CSSProperties,

packages/@headlessui-react/src/components/menu/menu.tsx

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -774,6 +774,7 @@ function ItemsFn<TTag extends ElementType = typeof DEFAULT_ITEMS_TAG>(
774774
tabIndex: 0,
775775
ref: itemsRef,
776776
style: {
777+
...theirProps.style,
777778
...style,
778779
'--button-width': useElementSize(state.buttonRef, true).width,
779780
} as CSSProperties,

packages/@headlessui-react/src/components/popover/popover.tsx

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -943,6 +943,7 @@ function PanelFn<TTag extends ElementType = typeof DEFAULT_PANEL_TAG>(
943943
: undefined,
944944
tabIndex: -1,
945945
style: {
946+
...theirProps.style,
946947
...style,
947948
'--button-width': useElementSize(state.button, true).width,
948949
} as React.CSSProperties,

0 commit comments

Comments
 (0)