BETTER-AUTH. UI
Mutations

isUsernameAvailableOptions

Check username availability.

Requires the Better Auth username plugin. If TypeScript cannot infer the plugin methods from your client, type or cast authClient as UsernameAuthClient from @better-auth-ui/solid.

This check is modeled as a mutation because callers usually trigger it from user input, not from route-level data loading. Returned data is typed as { available: boolean; message: string | null }.

Options factory

import { isUsernameAvailableOptions } from "@better-auth-ui/solid"
import { createMutation } from "@tanstack/solid-query"

const checkUsername = createMutation(() => isUsernameAvailableOptions(authClient))

checkUsername.mutate({ username: "alice" })

Params

Prop

Type

Last updated on

On this page