BETTER-AUTH. UI
Components

<UpdateFieldCard />

Generic settings card for updating custom user fields

Import

import { UpdateFieldCard } from "@better-auth/ui-react/components";

Installation

pnpm dlx shadcn@latest add https://stackproviders.github.io/better-auth-ui/r/update-field-card.json
npx shadcn@latest add https://stackproviders.github.io/better-auth-ui/r/update-field-card.json
yarn dlx shadcn@latest add https://stackproviders.github.io/better-auth-ui/r/update-field-card.json
bun x shadcn@latest add https://stackproviders.github.io/better-auth-ui/r/update-field-card.json

Usage

<UpdateFieldCard
  name="phoneNumber"
  label="Phone Number"
  type="text"
  placeholder="Enter your phone number"
/>

Props

NameTypeDefaultDescription
namestring(required)Field name in the user object
labelReactNodeundefinedDisplay label for the field
type"text" | "number" | "boolean""text"Input type for the field
valueunknownundefinedCurrent field value
placeholderstringundefinedInput placeholder text
requiredbooleanfalseWhether the field is required
descriptionReactNodeundefinedDescription text shown below the title
instructionsReactNodeundefinedAdditional instructions shown in the card
validate(value: string) => boolean | Promise<boolean>undefinedCustom validation function
classNamestringundefinedAdditional CSS classes for styling
classNamesSettingsCardClassNamesundefinedClass names for individual card components
localizationPartial<AuthLocalization>undefinedLocalization object for translations

Examples

Text Field

<UpdateFieldCard
  name="bio"
  label="Bio"
  type="text"
  placeholder="Tell us about yourself"
  description="A short description about you"
/>

Number Field

<UpdateFieldCard
  name="age"
  label="Age"
  type="number"
  required
  validate={(value) => Number(value) >= 18}
/>

Boolean Field

<UpdateFieldCard
  name="newsletter"
  label="Subscribe to newsletter"
  type="boolean"
  description="Receive updates about new features"
/>

Features

  • Supports text, number, and boolean field types
  • Built-in form validation
  • Custom validation support
  • Success/error feedback
  • Loading states during update
  • Checkbox UI for boolean fields
  • Integrated with Better Auth additional fields