<AdminButton /> A link to the admin dashboard that only app admins see. Auth auth Components / Admin Components / Admin Button auth
<AdminButton />

<AdminButton /> links to the admin dashboard and renders nothing for anyone who isn’t an app admin. The default layout doesn’t link to /admin, so add it to your navigation if admins should find the dashboard without typing the URL.
Quick start
src/routes/+layout.svelte
src/components/AppHeader.tsx
What it does
- Renders a link labelled Admin with a shield icon, pointing at
ADMIN_ROUTEfromadmin.constants.ts(/admin). - Renders nothing while
AUTH_CONSTANTS.adminis off, for signed-out visitors, for users who aren’t app admins, and while the admin check loads.
Props
class: replaces the default classesbtn preset-tonal gap-2.
className: replaces the default classesbtn preset-tonal gap-2.
Behavior
Hiding the link is only the UI. Every admin Convex function checks the caller’s role on the server, and the /admin page shows Access denied to anyone else.
To build your own entry point, use the hook the button uses, useIsAppAdmin(). It asks admin.queries.isCurrentUserAdmin and is false until the answer arrives. In SvelteKit it returns an object, so read admin.isAppAdmin instead of destructuring it.In Next.js it returns the boolean.
src/lib/components/SettingsNav.svelte
src/components/SettingsNav.tsx
Related
<AdminDashboard />: the page the button opens.- Admin dashboard: setup and roles.
<UserButton />: the account menu that usually sits next to it.