Accept optional strategy for the anchor prop (#3034)
* accept `strategy` for the `anchor` prop * update changelog
This commit is contained in:
@@ -22,6 +22,10 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
||||
|
||||
- Attempt form submission when pressing `Enter` on the `<Listbox.Button />` component ([#2972](https://github.com/tailwindlabs/headlessui/pull/2972))
|
||||
|
||||
### Added
|
||||
|
||||
- Accept optional `strategy` for the `anchor` prop ([#3034](https://github.com/tailwindlabs/headlessui/pull/3034))
|
||||
|
||||
## [2.0.0-alpha.4] - 2024-01-03
|
||||
|
||||
### Fixed
|
||||
|
||||
@@ -21,6 +21,11 @@ type Align = 'start' | 'end'
|
||||
type Placement = 'top' | 'right' | 'bottom' | 'left'
|
||||
|
||||
type BaseAnchorProps = {
|
||||
/**
|
||||
* The strategy to use when positioning the panel. Defaults to `fixed`.
|
||||
*/
|
||||
strategy: 'absolute' | 'fixed'
|
||||
|
||||
/**
|
||||
* The `gap` is the space between the trigger and the panel.
|
||||
*/
|
||||
@@ -166,6 +171,7 @@ export function FloatingProvider({
|
||||
offset = 0,
|
||||
padding = 0,
|
||||
inner,
|
||||
strategy = 'fixed',
|
||||
} = useResolvedConfig(config, floatingEl)
|
||||
let [to, align = 'center'] = placement.split(' ') as [Placement | 'selection', Align | 'center']
|
||||
|
||||
@@ -189,7 +195,7 @@ export function FloatingProvider({
|
||||
|
||||
// This component will be used in combination with a `Portal`, which means the floating
|
||||
// element will be rendered outside of the current DOM tree.
|
||||
strategy: 'fixed',
|
||||
strategy,
|
||||
|
||||
// We use the panel in a `Dialog` which is making the page inert, therefore no re-positioning is
|
||||
// needed when scrolling changes.
|
||||
|
||||
Reference in New Issue
Block a user