diff --git a/.changeset/metal-weeks-dress.md b/.changeset/metal-weeks-dress.md
new file mode 100644
index 00000000000..970638ce6ff
--- /dev/null
+++ b/.changeset/metal-weeks-dress.md
@@ -0,0 +1,5 @@
+---
+"@clerk/astro": patch
+---
+
+Introduce a shared component for interactive components that handles UI mounting
diff --git a/packages/astro/src/astro-components/interactive/InternalUIComponentRenderer.astro b/packages/astro/src/astro-components/interactive/InternalUIComponentRenderer.astro
new file mode 100644
index 00000000000..d0e89ccc541
--- /dev/null
+++ b/packages/astro/src/astro-components/interactive/InternalUIComponentRenderer.astro
@@ -0,0 +1,40 @@
+---
+interface Props {
+ [key: string]: unknown
+ component: 'sign-in' | 'sign-up' | 'organization-list' | 'organization-profile' | 'organization-switcher' | 'user-button' | 'user-profile'
+}
+
+import { customAlphabet, urlAlphabet } from "nanoid";
+
+const safeId = customAlphabet(urlAlphabet, 10)();
+
+const { component, ...props } = Astro.props
+---
+
+
+
+
diff --git a/packages/astro/src/astro-components/interactive/OrganizationList.astro b/packages/astro/src/astro-components/interactive/OrganizationList.astro
index 80f79607341..d5515f6c66a 100644
--- a/packages/astro/src/astro-components/interactive/OrganizationList.astro
+++ b/packages/astro/src/astro-components/interactive/OrganizationList.astro
@@ -2,40 +2,7 @@
import type { OrganizationListProps } from "@clerk/types";
type Props = OrganizationListProps
-import { customAlphabet, urlAlphabet } from "nanoid";
-
-const safeId = customAlphabet(urlAlphabet, 10)();
-
-const props = {
- ...Astro.props,
-}
+import InternalUIComponentRenderer from './InternalUIComponentRenderer.astro'
---
-
-
-
+
diff --git a/packages/astro/src/astro-components/interactive/OrganizationProfile.astro b/packages/astro/src/astro-components/interactive/OrganizationProfile.astro
index 14d6d26a9c1..b504c003180 100644
--- a/packages/astro/src/astro-components/interactive/OrganizationProfile.astro
+++ b/packages/astro/src/astro-components/interactive/OrganizationProfile.astro
@@ -2,40 +2,7 @@
import type { OrganizationProfileProps } from "@clerk/types";
type Props = OrganizationProfileProps
-import { customAlphabet, urlAlphabet } from "nanoid";
-
-const safeId = customAlphabet(urlAlphabet, 10)();
-
-const props = {
- ...Astro.props,
-}
+import InternalUIComponentRenderer from './InternalUIComponentRenderer.astro'
---
-
-
-
+
diff --git a/packages/astro/src/astro-components/interactive/OrganizationSwitcher.astro b/packages/astro/src/astro-components/interactive/OrganizationSwitcher.astro
index aad0c9289f1..1a5cab8e11e 100644
--- a/packages/astro/src/astro-components/interactive/OrganizationSwitcher.astro
+++ b/packages/astro/src/astro-components/interactive/OrganizationSwitcher.astro
@@ -2,40 +2,7 @@
import type { OrganizationSwitcherProps } from "@clerk/types";
type Props = OrganizationSwitcherProps
-import { customAlphabet, urlAlphabet } from "nanoid";
-
-const safeId = customAlphabet(urlAlphabet, 10)();
-
-const props = {
- ...Astro.props,
-}
+import InternalUIComponentRenderer from './InternalUIComponentRenderer.astro'
---
-
-
-
+
diff --git a/packages/astro/src/astro-components/interactive/SignIn.astro b/packages/astro/src/astro-components/interactive/SignIn.astro
index 41ffb52b179..e4e2ab869f8 100644
--- a/packages/astro/src/astro-components/interactive/SignIn.astro
+++ b/packages/astro/src/astro-components/interactive/SignIn.astro
@@ -1,42 +1,8 @@
---
import type { SignInProps } from "@clerk/types";
-type Props = SignInProps;
+type Props = SignInProps
-import { customAlphabet, urlAlphabet } from "nanoid";
-
-const safeId = customAlphabet(urlAlphabet, 10)();
-
-const props = {
- ...Astro.props
-}
+import InternalUIComponentRenderer from './InternalUIComponentRenderer.astro'
---
-
-
-
+
diff --git a/packages/astro/src/astro-components/interactive/SignUp.astro b/packages/astro/src/astro-components/interactive/SignUp.astro
index 80204a3a61c..50eaa548511 100644
--- a/packages/astro/src/astro-components/interactive/SignUp.astro
+++ b/packages/astro/src/astro-components/interactive/SignUp.astro
@@ -1,41 +1,8 @@
---
import type { SignUpProps } from "@clerk/types";
-type Props = SignUpProps;
+type Props = SignUpProps
-import { customAlphabet, urlAlphabet } from "nanoid";
-
-const safeId = customAlphabet(urlAlphabet, 10)();
-
-const props = {
- ...Astro.props
-}
+import InternalUIComponentRenderer from './InternalUIComponentRenderer.astro'
---
-
-
-
+
diff --git a/packages/astro/src/astro-components/interactive/UserButton.astro b/packages/astro/src/astro-components/interactive/UserButton.astro
index f8c7643daa4..acda2cd9258 100644
--- a/packages/astro/src/astro-components/interactive/UserButton.astro
+++ b/packages/astro/src/astro-components/interactive/UserButton.astro
@@ -1,37 +1,8 @@
---
import type { UserButtonProps } from "@clerk/types";
-type Props = UserButtonProps;
+type Props = UserButtonProps
-import { customAlphabet, urlAlphabet } from "nanoid";
-
-const safeId = customAlphabet(urlAlphabet, 10)();
+import InternalUIComponentRenderer from './InternalUIComponentRenderer.astro'
---
-
-
-
+
diff --git a/packages/astro/src/astro-components/interactive/UserProfile.astro b/packages/astro/src/astro-components/interactive/UserProfile.astro
index 82184d80c99..1cf962e5d2a 100644
--- a/packages/astro/src/astro-components/interactive/UserProfile.astro
+++ b/packages/astro/src/astro-components/interactive/UserProfile.astro
@@ -1,37 +1,8 @@
---
import type { UserProfileProps } from "@clerk/types";
-type Props = UserProfileProps;
+type Props = UserProfileProps
-import { customAlphabet, urlAlphabet } from "nanoid";
-
-const safeId = customAlphabet(urlAlphabet, 10)();
+import InternalUIComponentRenderer from './InternalUIComponentRenderer.astro'
---
-
-
-
+
diff --git a/packages/astro/src/client/mount-clerk-astro-js-components.ts b/packages/astro/src/client/mount-clerk-astro-js-components.ts
index 035bd35ef53..ba050907734 100644
--- a/packages/astro/src/client/mount-clerk-astro-js-components.ts
+++ b/packages/astro/src/client/mount-clerk-astro-js-components.ts
@@ -15,9 +15,10 @@ const mountAllClerkAstroJSComponents = () => {
} as const;
Object.entries(mountFns).forEach(([category, mountFn]) => {
- const elementsOfCategory = document.querySelectorAll(`[id^="clerk-${category}"]`);
+ const elementsOfCategory = document.querySelectorAll(`[data-clerk-id^="clerk-${category}"]`);
elementsOfCategory.forEach(el => {
- const props = window.__astro_clerk_component_props?.get(category)?.get(el.id);
+ const clerkId = el.getAttribute('data-clerk-id');
+ const props = window.__astro_clerk_component_props?.get(category)?.get(clerkId!);
if (el) {
$clerk.get()?.[mountFn](el as HTMLDivElement, props);
}