Skip to main content

Base UI support and more flexible (headless) auth components

Hi,

I’m currently using TanStack Router (with preload) and accessing router context throughout the app. This setup requires highly composable and flexible auth flows.

At the moment, Better Auth UI feels quite opinionated and tightly coupled to a component-based approach, which makes integration with TanStack Form and router-driven flows more difficult. It also seems to rely heavily on database calls instead of leveraging router context for auth state.

Are there any plans to:

  • Support Base UI instead of Radix?

  • Expose a more headless API for auth so it can better integrate with custom form and routing solutions?

A more unopinionated approach would make this much easier to adopt in advanced setups.

Status: Completed2 comments

Log in to comment and vote

Comments2

  • daveycodez

    Team•

    Apr 17

    If you use the new shadcn installation method it should work just fine with Base UI out of the box, since it uses whatever shadcn components are in your project.

    As for the forms, they are very simplified with no dependencies, there shouldn’t be much reason to change them to TanStack Form although I considered it. TanStack Form doesn’t support native browser validation errors, and that’s how I handle client side validation of the forms easily in v1.6.

    As for Router Context, you should be able to hook into the QueryClient. Simply use the query key [“auth”, “getSession”] for your session object. There will be more documentation on SSR and Router Context soon, but the useSession hook in v1.6 is just a TanStack Query hook with [“auth”, “getSession”] key. Better Auth UI will use whatever QueryClient is wrapping your app. It uses a basic one as a fallback if there is no QueryClient context.

    • Riku

      •

      Apr 21

      Can confirm. I’m using it with Base UI right now (shadcn installation method). Works great. Only required minor changes.