diff --git a/docs/src/components/stack-auth/stack-user-button-demo.tsx b/docs/src/components/stack-auth/stack-user-button-demo.tsx index 0893f8923..51a00cf3a 100644 --- a/docs/src/components/stack-auth/stack-user-button-demo.tsx +++ b/docs/src/components/stack-auth/stack-user-button-demo.tsx @@ -1,9 +1,8 @@ 'use client'; -import { UserButton } from '@stackframe/stack'; +import { UserButton, useUser } from '@stackframe/stack'; import { Wrench } from "lucide-react"; import { useState } from "react"; -import { StackContainer } from "../mdx"; import { DynamicCodeblock } from "../mdx/dynamic-code-block"; type UserButtonDemoProps = { @@ -19,7 +18,10 @@ export function UserButtonDemo() { extraItems: false, }); - // Mock user data + // Get the actual logged-in user + const user = useUser(); + + // Mock user data (used when no user is logged in) const mockUser = { displayName: "John Doe", primaryEmail: "john.doe@example.com", @@ -60,9 +62,9 @@ export function MyComponent() { return (
{/* Main demo area */} -
+
{/* Controls Panel */} -
+

Component Options

{/* Show User Info Toggle */} @@ -111,18 +113,34 @@ export function MyComponent() { {/* Component Preview */}

Live Preview

- - console.log("color mode toggle clicked") : undefined} - extraItems={props.extraItems ? [{ - text: 'Custom Action', - icon: , - onClick: () => console.log('Custom action clicked') - }] : undefined} - /> - +
+
+ {user ? ( + ✓ Using your actual account + ) : ( + → Using mock data (sign in to see your account) + )} +
+
+ {/* Component demo label */} +
+ Component Demo +
+ +
+ console.log("color mode toggle clicked") : undefined} + extraItems={props.extraItems ? [{ + text: 'Custom Action', + icon: , + onClick: () => console.log('Custom action clicked') + }] : undefined} + /> +
+
+