Skip to content

Commit

Permalink
Documentation tweaks
Browse files Browse the repository at this point in the history
  • Loading branch information
clauderic committed Jan 28, 2025
1 parent 7f9e94f commit 1801b6e
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 5 deletions.
7 changes: 4 additions & 3 deletions apps/docs/extend/modifiers.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ function App() {

Modifiers can also be applied to individual [draggable](/concepts/draggable) elements by passing them to the `modifiers` option.

For example, if you wanted to only enable the `RestrictToContainer` modifier for this specific draggable element, while using the `RestrictToHorizontalAxis` globally for all other draggable elements:
For example, if you wanted to only enable the `RestrictToElement` modifier for this specific draggable element, while using the `RestrictToHorizontalAxis` globally for all other draggable elements:

```js
import {Draggable} from '@dnd-kit/dom';
Expand All @@ -45,7 +45,8 @@ function App() {

const draggable = new Draggable({
id: 'draggable',
modifiers: [RestrictToContainer],
element,
modifiers: [RestrictToElement.configure({element: element.parentElement})],
}, manager);
}
```
Expand Down Expand Up @@ -76,7 +77,7 @@ These modifiers can be imported from `@dnd-kit/dom/modifiers`.
Restricts the movement of draggable elements to the window.
</ResponseField>

<ResponseField name="RestrictToContainer">
<ResponseField name="RestrictToElement">
Restricts the movement of draggable elements to the container element.
</ResponseField>

Expand Down
1 change: 1 addition & 0 deletions apps/docs/overview.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ description: 'Learn how to build drag and drop interfaces with <span class="inli
className="block hero-image"
src="/images/hero.svg"
alt="A modular toolkit for building drag and drop interfaces"
noZoom
/>

## Getting started
Expand Down
4 changes: 2 additions & 2 deletions apps/docs/react/hooks/use-draggable.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -148,12 +148,12 @@ And here is an example of how to restrict dragging to the container element of t

```jsx
import {useDraggable} from '@dnd-kit/react';
import {RestrictToContainer} from '@dnd-kit/dom/modifiers';
import {RestrictToElement} from '@dnd-kit/dom/modifiers';

function Draggable({id}) {
const {ref} = useDraggable({
id,
modifiers: [RestrictToContainer],
modifiers: [RestrictToElement.configure({element: document.body})],
});
}
```
Expand Down

0 comments on commit 1801b6e

Please sign in to comment.