DS0
Patterns

Profile Settings

A profile editing form with avatar upload, name, email, bio, and save/cancel actions.

Overview

The ProfileSettings recipe provides a profile editing card with avatar upload, name, email, and bio fields. It handles form state internally and calls onSubmit with the updated data.

Profile

Manage your public profile.

JD

Jane Cooper

jane@example.com

Usage

import { ProfileSettings } from '@/recipes/profile-settings';

<ProfileSettings
  initialValues={{
    name: 'John Doe',
    email: 'john@example.com',
    bio: 'Software engineer',
    avatarUrl: '/avatars/john.jpg',
  }}
  onSubmit={(data) => updateProfile(data)}
  onCancel={() => navigate('/settings')}
  onAvatarChange={(file) => uploadAvatar(file)}
/>

API Reference

PropTypeDefaultDescription
initialValuesProfileDataCurrent profile data
onSubmit(data: ProfileData) => voidSave handler
onCancel() => voidCancel handler
onAvatarChange(file: File) => void | Promise<string>Avatar upload handler
isLoadingbooleanfalseLoading state
errorstringError message
classNamestringAdditional CSS classes

ProfileData

interface ProfileData {
  name: string;
  email: string;
  bio?: string;
  avatarUrl?: string;
}

On this page