### Bash: Start Development Server Source: https://github.com/multiplehats/better-auth-ui-svelte/blob/main/README.md This bash command starts the Svelte development server. It typically includes hot module replacement and other features for a smooth development experience. Ensure all dependencies are installed and environment variables are configured. ```bash pnpm dev ``` -------------------------------- ### Bash: Install Dependencies Source: https://github.com/multiplehats/better-auth-ui-svelte/blob/main/README.md This bash command installs project dependencies using pnpm, a fast, reliable, and efficient package manager for Node.js. Ensure Node.js 18+ and pnpm are installed before running. ```bash pnpm install ``` -------------------------------- ### Install Better Auth UI Svelte Package Source: https://github.com/multiplehats/better-auth-ui-svelte/blob/main/README.md Installs the better-auth-ui-svelte package using various package managers. Ensure Better Auth and shadcn are set up in your project first. ```bash pnpm add better-auth-ui-svelte ## bun add better-auth-ui-svelte ## npm install better-auth-ui-svelte ## yarn add better-auth-ui-svelte ``` -------------------------------- ### Create Better Auth Client Instance Source: https://context7.com/multiplehats/better-auth-ui-svelte/llms.txt Illustrates the setup of the Better Auth client instance in TypeScript. This client is essential for all authentication operations and can be configured with various plugins like organization, two-factor authentication, and passkey support. ```typescript // src/lib/auth-client.ts import { createAuthClient } from 'better-auth/svelte'; import { organizationClient } from 'better-auth/client/plugins'; import { twoFactorClient } from 'better-auth/client/plugins'; import { passkeyClient } from '@better-auth/passkey/client'; export const authClient = createAuthClient({ baseURL: 'http://localhost:5173', plugins: [ organizationClient(), twoFactorClient(), passkeyClient() ] }); ``` -------------------------------- ### Install and Configure Better Auth UI Svelte Source: https://context7.com/multiplehats/better-auth-ui-svelte/llms.txt Instructions for installing the better-auth-ui-svelte package and configuring TailwindCSS to include the library's styles. This ensures the UI components are correctly styled within your Svelte application. ```bash # Install the package pnpm add better-auth-ui-svelte # Peer dependencies required # svelte ^5.0.0, better-auth ^1.3.0, bits-ui ^2.0.0, @lucide/svelte ^0.400.0 # tailwindcss ^4.0.0, zod ^4.0.0, svelte-sonner ^0.4.0 ``` ```css /* app.css - Add TailwindCSS v4 import */ @import 'better-auth-ui-svelte/css'; ``` -------------------------------- ### Bash: Configure Environment Variables Source: https://github.com/multiplehats/better-auth-ui-svelte/blob/main/README.md This bash command copies the example environment variables file to a new file named `.env`. You should then update the values in the `.env` file to match your development environment configuration. ```bash cp .env.example .env ``` -------------------------------- ### Server-Side Redirects with Path Helpers (TypeScript) Source: https://github.com/multiplehats/better-auth-ui-svelte/blob/main/README.md Illustrates how to use path helper functions within SvelteKit's server hooks (`hooks.server.ts`) to implement authentication redirects. This example shows redirecting unauthenticated users to the sign-in page and authenticated users away from the sign-in page. ```typescript // src/hooks.server.ts import { redirect } from '@sveltejs/kit'; import { getAuthPath } from 'better-auth-ui-svelte'; export async function handle({ event, resolve }) { const session = await getSession(event); // Redirect unauthenticated users to sign-in if (!session && event.url.pathname.startsWith('/app')) { throw redirect(303, getAuthPath('SIGN_IN')); } // Redirect authenticated users away from auth pages if (session && event.url.pathname === getAuthPath('SIGN_IN')) { throw redirect(303, '/app'); } return resolve(event); } ``` -------------------------------- ### Bash: Start Mailpit for Email Testing Source: https://github.com/multiplehats/better-auth-ui-svelte/blob/main/README.md This bash command starts Mailpit in detached mode using Docker Compose. Mailpit provides a local SMTP server and web UI for testing authentication emails like magic links and OTP codes. Access the UI at http://localhost:8025. ```bash docker compose up -d ``` -------------------------------- ### Bash: Stop Mailpit Source: https://github.com/multiplehats/better-auth-ui-svelte/blob/main/README.md This bash command stops the Mailpit services that were started using Docker Compose. It ensures that Mailpit and any associated containers are properly shut down. ```bash docker compose down ``` -------------------------------- ### Set Up AuthUIProvider in Root Layout (Svelte) Source: https://github.com/multiplehats/better-auth-ui-svelte/blob/main/README.md Wraps the application with authentication context. Requires importing AuthUIProvider, Toaster, authClient, and navigation functions. The AuthUIProvider takes the authClient as a prop and renders child components. ```svelte {@render children()} ``` -------------------------------- ### Set Up Better Auth Client in SvelteKit Source: https://github.com/multiplehats/better-auth-ui-svelte/blob/main/README.md Creates a Better Auth client instance in your SvelteKit project, typically in `src/lib/auth-client.ts`. Configure the `baseURL` and include any necessary plugins like `organizationClient` or `twoFactorClient`. ```typescript import { createAuthClient } from 'better-auth/svelte'; export const authClient = createAuthClient({ baseURL: 'http://localhost:5173', // Add any plugins you need plugins: [ // organizationClient(), // twoFactorClient(), // etc. ] }); ``` -------------------------------- ### Context Helpers in TypeScript Source: https://context7.com/multiplehats/better-auth-ui-svelte/llms.txt Illustrates how to access authentication context and configuration within any component nested under the AuthUIProvider. It shows how to retrieve the auth client, UI configuration, and localization strings. ```typescript import { getAuthUIConfig, getAuthClient, getLocalization } from 'better-auth-ui-svelte'; // Get full configuration const config = getAuthUIConfig(); const { authClient, basePath, social, hooks, mutators } = config; // Get auth client directly const authClient = getAuthClient(); const session = authClient.useSession(); // Get localization strings const localization = getLocalization(); console.log(localization.SIGN_IN); // 'Sign In' ``` -------------------------------- ### Set Up AuthUIProvider in Svelte Layout Source: https://context7.com/multiplehats/better-auth-ui-svelte/llms.txt Demonstrates how to wrap your Svelte application with the AuthUIProvider in your root layout file. This component provides authentication context and configuration, enabling features like social logins, magic links, passkeys, and more. ```svelte await invalidateAll()} social={{ providers: ['github', 'google', 'facebook'] }} magicLink passkey multiSession twoFactor={['otp', 'totp']} credentials={{ forgotPassword: true, rememberMe: true }} signUp={{ fields: ['name'] }} account={{ fields: ['image', 'name'] }} organization basePath="/auth" redirectTo="/dashboard" > {@render children()} ``` -------------------------------- ### Bash: Build Library Source: https://github.com/multiplehats/better-auth-ui-svelte/blob/main/README.md This bash command compiles the Better Auth UI Svelte library into a production-ready format. This is typically used when preparing the library for distribution or deployment. ```bash pnpm run build ``` -------------------------------- ### Shared Authentication Path Configuration (TypeScript) Source: https://github.com/multiplehats/better-auth-ui-svelte/blob/main/README.md Demonstrates how to create a shared configuration file for authentication paths in a SvelteKit application using 'better-auth-ui-svelte'. This approach centralizes path definitions, allowing for easy customization of base paths and individual view paths, ensuring consistency across the application. ```typescript // src/lib/config/auth-config.ts import type { PathConfig } from 'better-auth-ui-svelte'; export const authPathConfig: PathConfig = { basePath: '/auth', // Optionally customize individual paths viewPaths: { SIGN_IN: 'login', // /auth/login instead of /auth/sign-in SIGN_UP: 'register' // /auth/register instead of /auth/sign-up } }; ``` -------------------------------- ### Create Admin Interface Dynamic Routes (Svelte) Source: https://github.com/multiplehats/better-auth-ui-svelte/blob/main/README.md Sets up dynamic routes for the admin interface using `AdminView`. This allows for managing users, organizations, and viewing dashboards through distinct paths like `/app/admin/users` and `/app/admin/organizations`. It requires importing `AdminView` and handling route parameters. ```svelte ``` -------------------------------- ### Svelte Path Helpers Usage (TypeScript) Source: https://github.com/multiplehats/better-auth-ui-svelte/blob/main/README.md Demonstrates the usage of path helper functions provided by 'better-auth-ui-svelte' for generating authentication, account, organization, and admin paths. These functions are type-safe and ensure consistency across client-side and server-side SvelteKit applications, avoiding hardcoded paths. ```typescript import { getAuthPath, getAuthUrl, getAccountPath, getOrganizationPath, getAdminPath } from 'better-auth-ui-svelte'; // Get auth paths (default: '/auth') getAuthPath('SIGN_IN'); // '/auth/sign-in' getAuthPath('SIGN_UP'); // '/auth/sign-up' getAuthPath('FORGOT_PASSWORD'); // '/auth/forgot-password' // Get full URLs (useful for emails, redirects) getAuthUrl('RESET_PASSWORD', { baseURL: 'https://example.com' }); // 'https://example.com/auth/reset-password' // Account and organization paths getAccountPath('SETTINGS'); // '/account/settings' getOrganizationPath('MEMBERS'); // '/organization/members' // Admin paths getAdminPath('DASHBOARD'); // '/admin/dashboard' getAdminPath('USERS'); // '/admin/users' getAdminPath('ORGANIZATIONS'); // '/admin/organizations' ``` -------------------------------- ### Customize AuthUIProvider with Additional Settings (Svelte) Source: https://github.com/multiplehats/better-auth-ui-svelte/blob/main/README.md Demonstrates how to customize the AuthUIProvider with various options such as navigation callbacks, social login providers, and multi-factor authentication settings. It accepts props like `navigate`, `onSessionChange`, `social`, `magicLink`, `passkey`, `multiSession`, and `twoFactor`. ```svelte await invalidateAll()} social={{ providers: ['github', 'google', 'facebook'] }} magicLink passkey multiSession twoFactor={['otp', 'totp']} > ``` -------------------------------- ### TypeScript Path Helpers for Account, Organization, and Admin Source: https://context7.com/multiplehats/better-auth-ui-svelte/llms.txt Provides utility functions for generating URL paths and full URLs for account management, organization settings, and administrative interfaces. These helpers are designed for server-side compatibility. ```typescript import { getAccountPath, getAccountUrl, getAllAccountPaths, getOrganizationPath, getOrganizationUrl, getAllOrganizationPaths, getAdminPath, getAdminUrl, getAllAdminPaths } from 'better-auth-ui-svelte'; // Account paths getAccountPath('SETTINGS'); // '/account/settings' getAccountPath('SECURITY'); // '/account/security' getAccountPath('API_KEYS'); // '/account/api-keys' getAccountPath('ORGANIZATIONS'); // '/account/organizations' // Organization paths getOrganizationPath('SETTINGS'); // '/organization/settings' getOrganizationPath('MEMBERS'); // '/organization/members' getOrganizationPath('API_KEYS'); // '/organization/api-keys' // Admin paths getAdminPath('DASHBOARD'); // '/admin/dashboard' getAdminPath('USERS'); // '/admin/users' getAdminPath('ORGANIZATIONS'); // '/admin/organizations' // Full URLs with baseURL getAccountUrl('SETTINGS', { baseURL: 'https://example.com' }); // 'https://example.com/account/settings' ``` -------------------------------- ### TypeScript Path Helpers for Authentication Source: https://context7.com/multiplehats/better-auth-ui-svelte/llms.txt Provides utility functions for generating authentication-related URL paths and full URLs. These helpers are compatible with both client-side and server-side environments, ensuring consistent routing. ```typescript // src/hooks.server.ts import { redirect } from '@sveltejs/kit'; import { getAuthPath, getAuthUrl, getAllAuthPaths } from 'better-auth-ui-svelte'; // Get individual paths getAuthPath('SIGN_IN'); // '/auth/sign-in' getAuthPath('SIGN_UP'); // '/auth/sign-up' getAuthPath('FORGOT_PASSWORD'); // '/auth/forgot-password' getAuthPath('RESET_PASSWORD'); // '/auth/reset-password' getAuthPath('TWO_FACTOR'); // '/auth/two-factor' // With custom base path getAuthPath('SIGN_IN', { basePath: '/authentication' }); // '/authentication/sign-in' // With custom view paths getAuthPath('SIGN_IN', { viewPaths: { SIGN_IN: 'login' } }); // '/auth/login' // Get full URLs for emails/redirects getAuthUrl('RESET_PASSWORD', { baseURL: 'https://example.com' }); // 'https://example.com/auth/reset-password' // Get all paths as object const paths = getAllAuthPaths(); // { SIGN_IN: '/auth/sign-in', SIGN_UP: '/auth/sign-up', ... } // Server-side redirect example export async function handle({ event, resolve }) { const session = await getSession(event); if (!session && event.url.pathname.startsWith('/app')) { throw redirect(303, getAuthPath('SIGN_IN')); } if (session && event.url.pathname === getAuthPath('SIGN_IN')) { throw redirect(303, '/app'); } return resolve(event); } ``` -------------------------------- ### Bash: Lint and Format Code Source: https://github.com/multiplehats/better-auth-ui-svelte/blob/main/README.md These bash commands are used to maintain code quality and consistency. `pnpm run lint` checks for code style issues and potential errors, while `pnpm run format` automatically formats the code according to predefined style guidelines. ```bash pnpm run lint pnpm run format ``` -------------------------------- ### AdminDashboard Component Configuration in Svelte Source: https://context7.com/multiplehats/better-auth-ui-svelte/llms.txt Allows direct use of the AdminDashboard component with custom configuration for table limits and visibility of 'View All' actions. It accepts props to set the number of items per table and links to dedicated views. ```svelte ``` -------------------------------- ### Create Dynamic Auth Pages Route (Svelte) Source: https://github.com/multiplehats/better-auth-ui-svelte/blob/main/README.md Sets up a single dynamic route (`/auth/[path]/+page.svelte`) to handle all authentication views. It uses the `AuthView` component and extracts the `path` from the route parameters. This route supports various authentication flows like sign-in, sign-up, password reset, and more. ```svelte
``` -------------------------------- ### AuthUIProvider Configuration Props (TypeScript) Source: https://github.com/multiplehats/better-auth-ui-svelte/blob/main/README.md Defines the configuration options for the AuthUIProvider component in Better Auth UI Svelte. It accepts an auth client, navigation callbacks, session management hooks, social authentication providers, various authentication methods (magic link, email verification, passkey), two-factor authentication settings, multi-session support, localization, avatar handling, settings page configuration, and organization settings. ```typescript interface AuthUIProviderProps { // Required authClient: ReturnType; // Navigation (SvelteKit) navigate?: (href: string) => void; // Session management onSessionChange?: () => void | Promise; // Social authentication social?: { providers?: ('google' | 'github' | 'facebook' | 'apple' | 'discord' | 'twitter')[]; }; // Additional auth methods magicLink?: | boolean | { resendCooldown?: number; redirectToSentPage?: boolean; }; emailVerification?: | boolean | { resendCooldown?: number; redirectToVerifyPage?: boolean; }; passkey?: boolean; // Two-factor authentication twoFactor?: ('otp' | 'totp')[]; // Multi-session support multiSession?: boolean; // Localization localization?: Partial; // Avatar handling avatar?: { upload?: (file: File) => Promise; delete?: (url: string) => Promise; }; // Settings page configuration settings?: { url?: string; }; // Organization configuration organization?: { pathMode?: 'id' | 'slug'; basePath?: string; slug?: string; }; } ``` -------------------------------- ### TypeScript Path Helper Functions Source: https://github.com/multiplehats/better-auth-ui-svelte/blob/main/README.md These TypeScript functions are used to generate authentication, account, organization, and admin paths. They can optionally accept a configuration object and can return either a relative path or a full URL with a base URL. ```typescript // Auth paths getAuthPath(view, config?) getAuthUrl(view, config?) getAllAuthPaths(config?) // Account paths getAccountPath(view, config?) getAccountUrl(view, config?) getAllAccountPaths(config?) // Organization paths getOrganizationPath(view, config?) getOrganizationUrl(view, config?) getAllOrganizationPaths(config?) // Admin paths getAdminPath(view, config?) getAdminUrl(view, config?) getAllAdminPaths(config?) ``` -------------------------------- ### Using Shared Auth Path Config in Svelte Layout (Svelte) Source: https://github.com/multiplehats/better-auth-ui-svelte/blob/main/README.md Shows how to integrate the shared authentication path configuration into a Svelte layout component (`+layout.svelte`) using the `AuthUIProvider`. This ensures that the provider component utilizes the custom base path and view paths defined in the configuration file. ```svelte ``` -------------------------------- ### Customize Localization with AuthUIProvider in Svelte Source: https://github.com/multiplehats/better-auth-ui-svelte/blob/main/README.md Demonstrates how to customize text strings for the Better Auth UI by passing a `localization` prop to the `AuthUIProvider` component. This allows for overriding default labels for actions like sign-in, sign-up, and input fields. ```svelte ``` -------------------------------- ### Using Shared Auth Path Config in Server Hooks (TypeScript) Source: https://github.com/multiplehats/better-auth-ui-svelte/blob/main/README.md Demonstrates how to apply the shared authentication path configuration to server-side redirects within SvelteKit's hooks (`hooks.server.ts`). By passing the `authPathConfig` to `getAuthPath`, server-side logic can consistently use the same path definitions as the client-side. ```typescript // src/hooks.server.ts import { redirect } from '@sveltejs/kit'; import { getAuthPath } from 'better-auth-ui-svelte'; import { authPathConfig } from '$lib/config/auth-config'; // Use same config for server-side redirects throw redirect(303, getAuthPath('SIGN_IN', authPathConfig)); ``` -------------------------------- ### Redirect Unauthenticated Users with RedirectToSignIn Component Source: https://context7.com/multiplehats/better-auth-ui-svelte/llms.txt Shows how to use the `SignedOut` and `RedirectToSignIn` components from `better-auth-ui-svelte` to automatically redirect users to the sign-in page if they are not authenticated. This is typically used on protected pages within a SvelteKit application. ```svelte ``` -------------------------------- ### Svelte SignUpForm Component Source: https://context7.com/multiplehats/better-auth-ui-svelte/llms.txt Renders a customizable registration form. It accepts props for redirection paths and custom CSS class names to style the form elements. ```svelte ``` -------------------------------- ### Implement AuthView Component for Dynamic Routing Source: https://context7.com/multiplehats/better-auth-ui-svelte/llms.txt Shows how to use the AuthView component in a Svelte page to handle all authentication views dynamically based on the route. This component simplifies the management of various authentication flows, including sign-in, sign-up, password reset, and more. ```svelte
``` -------------------------------- ### Use Reactive Hooks in Svelte Components Source: https://context7.com/multiplehats/better-auth-ui-svelte/llms.txt Demonstrates how to use reactive hooks like `useAuthenticate` and `useCurrentOrganization` from the `better-auth-ui-svelte` library within Svelte components. These hooks manage authentication state and organization data, enabling conditional rendering based on authentication status and organization details. ```svelte {#if isPending}

Loading organization...

{:else if organization}

{organization.name}

{/if} ``` -------------------------------- ### AccountSettingsCards Component in Svelte Source: https://context7.com/multiplehats/better-auth-ui-svelte/llms.txt Provides a complete account settings UI, including sections for avatar, name, username, and connected accounts. It supports custom styling through the 'classNames' prop for different card elements. ```svelte

Account Settings

``` -------------------------------- ### Localization Customization in Svelte Source: https://context7.com/multiplehats/better-auth-ui-svelte/llms.txt Demonstrates how to customize all text strings within the Auth UI by providing a custom localization object to the AuthUIProvider. This allows for internationalization and branding. ```svelte ``` -------------------------------- ### Conditional Rendering with SignedIn and SignedOut (Svelte) Source: https://github.com/multiplehats/better-auth-ui-svelte/blob/main/README.md Demonstrates conditional rendering based on user authentication status using `SignedIn` and `SignedOut` components. `SignedOut` renders its children when the user is not logged in, typically for sign-in links. `SignedIn` renders its children when the user is authenticated, often for dashboard links. ```svelte Sign In Dashboard ``` -------------------------------- ### Svelte SignedIn and SignedOut Components for Conditional Rendering Source: https://context7.com/multiplehats/better-auth-ui-svelte/llms.txt These components allow for conditional rendering of UI elements based on the user's authentication status. They are useful for showing different navigation or content to signed-in versus signed-out users. ```svelte ``` -------------------------------- ### Display User Button Component (Svelte) Source: https://github.com/multiplehats/better-auth-ui-svelte/blob/main/README.md Illustrates the usage of the `UserButton` component, which displays the user's avatar and a dropdown menu for actions like sign-out. The `align` prop can be used to control the dropdown's alignment. This component provides a convenient way to manage user-specific interactions. ```svelte ``` -------------------------------- ### OrganizationSettingsCards Component in Svelte Source: https://context7.com/multiplehats/better-auth-ui-svelte/llms.txt Provides a comprehensive UI for managing organization settings, including name, slug, logo, members, invitations, and a danger zone. Custom styling for the cards can be applied using the 'classNames' prop. ```svelte
``` -------------------------------- ### Use Individual SignInForm Component in Svelte Source: https://context7.com/multiplehats/better-auth-ui-svelte/llms.txt Demonstrates how to use the SignInForm component directly for custom placement and behavior within your Svelte application. This allows for more granular control over the sign-in process and its associated UI elements. ```svelte ``` -------------------------------- ### Apply Custom Class Names to Svelte Components Source: https://github.com/multiplehats/better-auth-ui-svelte/blob/main/README.md Illustrates how to apply custom CSS classes to Svelte components for styling. It shows two methods: using the `className` prop for a single class and the `classNames` prop for granular control over different parts of a component. ```svelte ``` ```svelte ``` -------------------------------- ### TypeScript Exports for Better Auth UI Svelte Source: https://github.com/multiplehats/better-auth-ui-svelte/blob/main/README.md This TypeScript code details the various exports from the Better Auth UI Svelte library. It includes component exports, path constants, path helper functions, utility functions, context helpers, localization objects, and type definitions. ```typescript // Component exports export { AuthView, AuthUIProvider, SignInForm, SignUpForm, UserButton, UserAvatar, ... }; // Path constants export { authViewPaths, accountViewPaths, organizationViewPaths, adminViewPaths }; // Path helpers (unique to Svelte port) export { getAuthPath, getAuthUrl, getAccountPath, getAccountUrl, getOrganizationPath, getOrganizationUrl, getAdminPath, getAdminUrl, getAllAuthPaths, getAllAccountPaths, getAllOrganizationPaths, getAllAdminPaths }; // Utilities export { createForm, getViewByPath }; // Context helpers export { getAuthUIConfig, getAuthClient, getLocalization }; // Localization export { authLocalization }; // Types export type { AuthUIConfig, User, Session, AuthLocalization, PathConfig, AccountPathConfig, OrganizationPathConfig, AdminPathConfig, UserWithRole, Organization, OrganizationMember, OrganizationWithMembers, OrganizationInvitation, UsersAdminTableProps, OrganizationsAdminTableProps, AdminViewProps }; ``` -------------------------------- ### SecuritySettingsCards Component in Svelte Source: https://context7.com/multiplehats/better-auth-ui-svelte/llms.txt Integrates security settings such as password changes, session management, passkeys, and two-factor authentication. Custom styling can be applied to the cards using the 'classNames' prop. ```svelte

Security Settings

``` -------------------------------- ### AdminView Component in Svelte Source: https://context7.com/multiplehats/better-auth-ui-svelte/llms.txt Renders an admin dashboard with user and organization management capabilities. Requires the Better Auth admin plugin. It accepts a 'path' prop to determine the view and allows custom CSS class names for styling. ```svelte ``` -------------------------------- ### Svelte UserButton Component for User Menu Source: https://context7.com/multiplehats/better-auth-ui-svelte/llms.txt Displays a user dropdown menu, typically including the user's avatar, account switching options, and navigation links. It supports customization of alignment, size, additional links, and CSS class names. ```svelte

My App

``` -------------------------------- ### Configure Tailwind CSS for Better Auth UI Svelte Source: https://github.com/multiplehats/better-auth-ui-svelte/blob/main/README.md Configures Tailwind CSS for Better Auth UI Svelte. For Tailwind CSS v4, import 'better-auth-ui-svelte/css' in your global CSS. For v3 (deprecated), specify the path in your Tailwind config's content array. ```css /* app.css or global.css */ @import 'better-auth-ui-svelte/css'; ``` ```js content: ['./node_modules/better-auth-ui-svelte/dist/**/*.{js,svelte}']; ``` -------------------------------- ### OrganizationSwitcher Component in Svelte Source: https://context7.com/multiplehats/better-auth-ui-svelte/llms.txt Enables users to switch between different organizations via a dropdown menu. It accepts alignment, size, and callback props for handling organization changes and custom styling for the trigger and menu. ```svelte ``` -------------------------------- ### Svelte UserAvatar Component Source: https://context7.com/multiplehats/better-auth-ui-svelte/llms.txt Displays a user's avatar, with a fallback mechanism to show the user's initials if the avatar image is unavailable. It accepts user data and custom class names for styling. ```svelte ``` === COMPLETE CONTENT === This response contains all available snippets from this library. No additional content exists. Do not make further requests.