# Drag and drop between Ontology SDK applications Palantir provides a [React ↗](https://react.dev/) library you can integrate with the [Ontology SDK (OSDK)](../../ontology-sdk/overview/index.md), enabling you to create and implement drag and drop functionality between custom applications. The `@palantir/dnd-osdk-react` library provides type-safe components and hooks you can use to configure [drag and drop zones](../drag-and-drop-overview/index.md) to transfer objects and object sets between different parts of your application and other Palantir platform applications, such as [Workshop](../../workshop/overview/index.md), [Object Explorer](../../object-explorer/overview/index.md), or Gaia.  ## Core library features and key concepts * **OSDK integration:** Built specifically for Palantir's OSDK with automatic object set hydration and metadata handling. * **Flexible data support and serialization:** Accepts both OSDK objects and object sets as well as custom data types in the same drop zone. Additionally, the library serializes all object and object set data. * **Performance optimization:** Uses deep comparison memoization to prevent unnecessary backend calls. * **Customizable visual feedback:** Offers built-in, customizable support for styling drop zones based on drag state. * **Object type definition:** You can define which [object types](../../object-link-types/object-types-overview/index.md) your drag and drop zones accept. * **Object set conversion and transportation:** All dropped objects are automatically converted to object sets for consistent handling across application boundaries. * **Client integration:** The library requires that you generate an [OSDK client](../../developer-console/create-application/index.md) to enable metadata fetching and object set operations. ## Add the library to Code Workspaces To begin building with the OSDK and the `@palantir/dnd-osdk-react` library, navigate to [Code Workspaces](../../code-workspaces/overview/index.md) and create a new [VS Code workspace](../../vs-code/overview/index.md) with **React** as the repository type.  Search for and select the `@palantir/dnd-osdk-react` library from your workspace's **Libraries** panel. If you are unable to locate the library in Code Workspaces, contact Palantir Support.  Once you add the library to your workspace, you will be able to use its hooks and components to handle drag and drop workflows across custom OSDK and Palantir platform applications. Review the examples below to help you get started. ### Example: Create a drag zone Use the `OsdkObjectDragZone` component to render OSDK object data as draggable. When your application's users drag the content, then the associated object data is automatically included in the drag payload. To create a drag zone with an object set, you can reference the code sample below which: 1. Imports the specific object types from your generated OSDK, which you will use to construct object sets or singular objects for your drag zone. 2. Uses a generated OSDK client to create object sets that represent queries or collections of objects. Alternatively, you can use previously fetched object instances. 3. Places relevant [JSX ↗](https://react.dev/learn/writing-markup-with-jsx) content inside the `OsdkObjectDragZone` component, ensuring the content is draggable. 4. Configures the `client` to reference a generated OSDK client and an `objectSet` that will be included in the drag payload. ```typescript import { MyObjectType } from "@my-osdk-lib/sdk"; // Import your object type import { OsdkObjectDragZone } from "@palantir/dnd-osdk-react"; import client from "./client"; import { ObjectSet } from "@osdk/api"; // create an object set from MyObjectType const objectSet = client(MyObjectType); function ObjectSetDragExample() { return (
Drag me!
Drop objects here!
Drop MyObjectTypes here!