Skip to documentation

Design system / Molecules

Molecule / Navigation

AuthButton

AuthButton selects a sign-in link or account menu from supplied identity props. It does not look up a session or perform authentication. Shell instances supply its destinations.

Live example

Live preview

Current component with fictional data. Example changes are not persisted.

Sign in

Identity is sample props. Sign-in/out destinations are local anchors, not authentication operations. Each authenticated menu includes Appearance, including the unnamed Account fallback. Mode changes here are temporary.

Responsibility

The component presents one account-action concern from supplied identity data. Authentication vocabulary makes it navigation-owned rather than generic UI. Session verification and sign-in/out operations remain outside the molecule.

Public contract

The table describes supported inputs, exported parts and caller responsibilities. A callback supplies a command, such as saving a draft. These notes are maintained manually; check current source types before integration.

Maintained component API notes; current source is authoritative
Prop / partTypeRequirementResponsibility
isAuthenticatedbooleanRequiredSupplied identity state; the component does not verify a session.
signInHref / signOutHrefstringRequiredConsumer supplies destinations.
userDisplayName / userEmailstringOptionalBoth presentations show the same person icon and use the supplied name as their accessible label, with Account as fallback. Name and email appear only inside the opened menu, never as visible trigger text.
presentation"topbar" | "sidebar"Default topbarBoth triggers are icon-only with pointer, hover and keyboard focus feedback. Topbar opens downward; sidebar opens upward from its pinned slot. Both menus stay in their theme/modal owner.
classNamestringOptionalMerged into the active link or menu trigger.

API notes are curated documentation, not generated types. The source linked above is the current implementation; update these notes alongside API changes.

State and behavior

Identify which values the caller controls and which behavior the component or underlying primitive owns. A local example does not supply persistence, authorization or a complete product lifecycle.

No auth lookup or transport is embedded. Radix manages menu disclosure, radio selection, keyboard focus and dismissal. A local element reference keeps either portal inside its theme/modal owner. useColorMode consumes next-themes ambient browser state; localStorage remembers light/dark choices. Documentation supplies temporary preview state instead. Sign out uses a native full-page anchor to the supplied destination, without client prefetch or an RSC request followed by navigation.

Dependencies

  • Next Link for sign-in / native anchor for sign-out
  • buttonVariants()
  • DropdownMenu trigger, label, separator, radio group and item
  • ColorModeMenuItems / useColorMode
  • cn()

Token and styling contract

These notes identify theme roles, utilities and direct style values used by the source. Direct colors or timings are implementation exceptions, not recommendations to bypass the theme.

outline / sm buttonVariants
Anonymous sign-in link styling.
hover:bg-accent / text-muted-foreground
Named-user trigger and supporting email.
text-md / text-label / text-supporting
Fluid account and supporting identity roles. The topbar trigger retains the full name as its accessible label without visible name text.

Boundaries and limitations

  • UI visibility is not an authorization boundary.
  • There is no loading, sign-out pending or error prop. Destinations own the operation.
  • Appearance changes presentation only, not tenant branding settings or permissions. If browser storage is denied, switching works but persistence is unavailable.

Where to make a change

Change the shared person-icon trigger in authButton.tsx; shell instances bind identity and destinations. The bounded menu wraps the complete identity. presentation defaults to topbar; sidebar changes menu placement, not trigger content. Keep session verification and logout operations outside this view.

Selected real uses

ConsoleShell

Supplies identity and sign-in/out destinations in TopNav's right-hand slot for basic/focused/Catalogue pages, or SidebarShell's pinned account slot for advanced pages. ConsoleShell is the product binding; AuthButton remains a navigation-owned molecule. Both triggers show only the person icon. Topbar uses Account for an email-only server fallback, keeping email inside the menu.

src/components/navigation/instances/consoleShell.tsx

These traces describe selected uses, not every dependency. Repository-only paths are shown as references; only approved files have public source views.

Usage contract

import { AuthButton } from "@/components/navigation/authButton";

<AuthButton isAuthenticated={isAuthenticated}
  signInHref={signInHref} signOutHref={signOutHref}
  userDisplayName={displayName} userEmail={email}
  presentation="sidebar" />

Illustrative consumer bindings, not a self-contained product workflow. Live examples supply only local state or explicit fictional props.

All molecules
Current components and theme tokens. Fictional example data. Source views refresh on deployment; authors maintain contract notes.