mirror of
https://github.com/stack-auth/stack.git
synced 2026-06-13 21:01:21 +08:00
<!-- Make sure you've read the CONTRIBUTING.md guidelines: https://github.com/stack-auth/stack-auth/blob/dev/CONTRIBUTING.md --> Removes Platform selection, moves docs to single /content folder and no longer gens docs. Only API docs are generated here. <!-- RECURSEML_SUMMARY:START --> ## High-level PR Summary This PR makes significant changes to the documentation structure by removing platform-specific content organization and consolidating docs into a single `/content` folder. The primary goal is to simplify the documentation architecture by eliminating the platform-specific routing (Next.js, React, JavaScript, Python) and instead organizing content by topic (guides, SDK, components) regardless of platform. The PR removes platform selection functionality, platform-specific navigation, and the automatic generation of platform-specific documentation pages. It introduces a new docs tree filtering system that organizes content by section rather than by platform. These changes should make the documentation more maintainable and easier to navigate while focusing on the content itself rather than platform-specific variations. ⏱️ Estimated Review Time: 30-90 minutes <details> <summary>💡 Review Order Suggestion</summary> | Order | File Path | |-------|-----------| | 1 | `docs/package.json` | | 2 | `docs/src/lib/docs-tree.ts` | | 3 | `docs/src/lib/navigation-utils.ts` | | 4 | `docs/src/components/homepage/iconHover.tsx` | | 5 | `docs/src/components/sdk/overview.tsx` | | 6 | `docs/src/components/layouts/shared/section-utils.ts` | | 7 | `docs/src/components/layout/custom-search-dialog.tsx` | | 8 | `docs/src/app/api/search/route.ts` | | 9 | `docs/src/app/docs/[[...slug]]/page.tsx` | | 10 | `docs/src/components/layouts/docs-header-wrapper.tsx` | | 11 | `docs/src/components/layouts/docs-layout-router.tsx` | | 12 | `docs/src/components/layouts/docs.tsx` | | 13 | `package.json` | </details> [](https://discord.gg/n3SsVDAW6U) <!-- RECURSEML_SUMMARY:END --> <!-- This is an auto-generated comment: release notes by coderabbit.ai --> ## Summary by CodeRabbit * **Documentation** * Added many new guides (auth providers, OAuth, JWT, API keys, emails, webhooks, orgs/teams, permissions, onboarding, customization), expanded SDK & component reference pages, examples, and navigation metadata. * Switched docs to a simpler section-based, platform-agnostic structure and improved getting-started and production checklists. * **Developer Experience** * Enhanced docs UX: improved code-example UI with platform/framework selectors, theme-aware highlighted code blocks, image zoom, and a centralized code-sample registry. <!-- end of auto-generated comment: release notes by coderabbit.ai --> --------- Co-authored-by: Konstantin Wohlwend <n2d4xc@gmail.com>
80 lines
1.9 KiB
Plaintext
80 lines
1.9 KiB
Plaintext
---
|
|
title: "<UserButton />"
|
|
---
|
|
|
|
The `<UserButton>` renders a user button component with optional user information, color mode toggle, and extra menu items.
|
|
|
|
## Interactive Demo
|
|
|
|
Try out the UserButton component with different props and see the changes in real-time:
|
|
|
|
<UserButtonDemo />
|
|
|
|
## Props
|
|
|
|
<PropTable
|
|
props={[
|
|
{
|
|
name: "showUserInfo",
|
|
type: "boolean",
|
|
description: "If true, displays user information (display name and email) in the button.",
|
|
optional: true,
|
|
default: "false"
|
|
},
|
|
{
|
|
name: "colorModeToggle",
|
|
type: "() => void | Promise<void>",
|
|
description: "Function to be called when the color mode toggle button is clicked. If specified, a color mode toggle button will be shown.",
|
|
optional: true,
|
|
default: "undefined"
|
|
},
|
|
{
|
|
name: "extraItems",
|
|
type: "Array",
|
|
description: "Additional menu items to display. Each item should have the following properties:",
|
|
optional: true,
|
|
nested: [
|
|
{
|
|
name: "text",
|
|
type: "string",
|
|
description: "The text to display for the item."
|
|
},
|
|
{
|
|
name: "icon",
|
|
type: "React.ReactNode",
|
|
description: "The icon to display for the item."
|
|
},
|
|
{
|
|
name: "onClick",
|
|
type: "() => void | Promise<void>",
|
|
description: "Function to be called when the item is clicked."
|
|
}
|
|
]
|
|
}
|
|
]}
|
|
/>
|
|
|
|
## Example
|
|
|
|
```tsx
|
|
'use client';
|
|
import { UserButton } from '@stackframe/stack';
|
|
|
|
export default function Page() {
|
|
return (
|
|
<div>
|
|
<h1>User Button</h1>
|
|
<UserButton
|
|
showUserInfo={true}
|
|
colorModeToggle={() => { console.log("color mode toggle clicked") }}
|
|
extraItems={[{
|
|
text: 'Custom Action',
|
|
icon: <CustomIcon />,
|
|
onClick: () => console.log('Custom action clicked')
|
|
}]}
|
|
/>
|
|
</div>
|
|
);
|
|
}
|
|
```
|