Skip to content

Commit 92fc2e4

Browse files
committed
docs: additional v1 updates
docs: also add concrete example for offset recreating placement: 'center'
1 parent dc11580 commit 92fc2e4

File tree

3 files changed

+14
-15
lines changed

3 files changed

+14
-15
lines changed

website/pages/docs/computePosition.mdx

+2-2
Original file line numberDiff line numberDiff line change
@@ -173,15 +173,15 @@ extend the behavior of the library.
173173
## Return value
174174

175175
```ts
176-
type ComputePositionReturn = {
176+
interface ComputePositionReturn {
177177
x: number;
178178
y: number;
179179
// The stateful placement, which can be different
180180
// from the initial `placement` passed as options
181181
placement: Placement;
182182
strategy: Strategy;
183183
middlewareData: MiddlewareData;
184-
};
184+
}
185185
```
186186

187187
## Updating

website/pages/docs/inline.mdx

-5
Original file line numberDiff line numberDiff line change
@@ -97,10 +97,5 @@ can be passed in to choose a rect.
9797

9898
default: `2{:js}`
9999

100-
> Experimental
101-
102100
This describes the padding around a disjoined rect when choosing
103101
it.
104-
105-
This option's configurability is currently experimental and may
106-
be removed by v1. You likely don't need to change the default.

website/pages/docs/offset.mdx

+12-8
Original file line numberDiff line numberDiff line change
@@ -58,11 +58,9 @@ interface AxesOffsets {
5858
type Options =
5959
| number
6060
| AxesOffsets
61-
| (({
62-
reference: Rect,
63-
floating: Rect,
64-
placement: Placement,
65-
}) => number | AxesOffsets);
61+
| ((
62+
middlewareArguments: MiddlewareArguments
63+
) => number | AxesOffsets);
6664
```
6765

6866
A number represents the distance (gutter or margin) between the
@@ -145,6 +143,12 @@ values enables the ability to "inset" the floating element such
145143
that it is positioned on top of the reference element in some
146144
fashion.
147145

148-
This is useful for UI components such as select dropdowns where
149-
it should be positioned relative to an item inside the dropdown
150-
list.
146+
For instance, if you wanted to mimic something like
147+
`'center'{:js}` for `placement{:.objectKey}` (with default
148+
placement):
149+
150+
```js
151+
offset(({rects}) => {
152+
return -rects.reference.height / 2 - rects.floating.height / 2;
153+
});
154+
```

0 commit comments

Comments
 (0)