diff --git a/packages/plugin-search/src/Search/ui/index.client.tsx b/packages/plugin-search/src/Search/ui/index.client.tsx
new file mode 100644
index 00000000000..dc6a9f7d42b
--- /dev/null
+++ b/packages/plugin-search/src/Search/ui/index.client.tsx
@@ -0,0 +1,65 @@
+'use client'
+
+import type { FormState } from 'payload/types'
+
+import { useWatchForm } from '@payloadcms/ui/forms/Form'
+import { useConfig } from '@payloadcms/ui/providers/Config'
+import React from 'react'
+// TODO: fix this import to work in dev mode within the monorepo in a way that is backwards compatible with 1.x
+// import CopyToClipboard from 'payload/dist/admin/components/elements/CopyToClipboard'
+
+type FieldsWithDoc = FormState & {
+ doc: {
+ value: {
+ relationTo: string
+ value: string
+ }
+ }
+}
+
+export const LinkToDocClient: React.FC = () => {
+ const form = useWatchForm()
+ const fields = form.fields as FieldsWithDoc
+
+ const {
+ doc: {
+ value: { relationTo, value: docId },
+ },
+ } = fields
+
+ const config = useConfig()
+
+ const {
+ routes: {
+ admin: adminRoute, // already includes leading slash
+ },
+ serverURL,
+ } = config
+
+ const href = `${serverURL}${adminRoute}/collections/${relationTo}/${docId}`
+
+ return (
+
+
+
+ Doc URL
+
+ {/* */}
+
+
+
+ )
+}
diff --git a/packages/plugin-search/src/Search/ui/index.tsx b/packages/plugin-search/src/Search/ui/index.tsx
index e053e43db3e..fb619224f13 100644
--- a/packages/plugin-search/src/Search/ui/index.tsx
+++ b/packages/plugin-search/src/Search/ui/index.tsx
@@ -1,63 +1,13 @@
-import type { FormState, UIField } from 'payload/types'
+import type { UIField } from 'payload/types'
-import { useWatchForm } from '@payloadcms/ui/forms/Form'
-import { useConfig } from '@payloadcms/ui/providers/Config'
import React from 'react'
-// TODO: fix this import to work in dev mode within the monorepo in a way that is backwards compatible with 1.x
-// import CopyToClipboard from 'payload/dist/admin/components/elements/CopyToClipboard'
-type FieldsWithDoc = FormState & {
- doc: {
- value: {
- relationTo: string
- value: string
- }
- }
-}
+import { LinkToDocClient } from './index.client.js'
export const LinkToDoc: React.FC = () => {
- const form = useWatchForm()
- const fields = form.fields as FieldsWithDoc
-
- const {
- doc: {
- value: { relationTo, value: docId },
- },
- } = fields
-
- const config = useConfig()
-
- const {
- routes: {
- admin: adminRoute, // already includes leading slash
- },
- serverURL,
- } = config
-
- const href = `${serverURL}${adminRoute}/collections/${relationTo}/${docId}`
-
return (
-
-
- Doc URL
-
- {/* */}
-
-
+
)
}