Settings Form
ProAn account-profile editing block: an avatar with change and remove controls, a name row, a prefixed username, email and a bio with a live count, closed by a Cancel and Save footer.
Installation#
Usage#
This example is part of Koala UI Pro
The preview is yours to explore. Its code comes with a Pro license, paid once and used in every project.
Have a license? Unlock it here
API reference#
SettingsForm
A <form> card composing Avatar, Field, Input and Textarea; it owns the field state and the saved confirmation. Forwards all native <form> props except onSubmit, and accepts className, merged last.
| Prop | Type | Default | Description |
|---|---|---|---|
| defaultValues | Partial<SettingsFormData> | - | Initial firstName, lastName, username, email and bio; missing keys start empty. |
| onSave | (data: SettingsFormData) => void | Promise<void> | - | Called with the full form data on submit. Return a promise to keep Save loading until it settles. |
| onCancel | () => void | - | Called when Cancel is pressed. |
| onPhotoChange | (file: File) => void | - | Called with the file picked through Change photo; the avatar previews it at once. Upload it and pass the stored URL back as avatarSrc. Without it, Change photo is hidden. |
| onPhotoRemove | () => void | - | Called when Remove is pressed; the avatar falls back to initials. Without it, or with no photo showing, Remove is hidden. |
| photoAccept | string | "image/jpeg,image/gif,image/png" | File types the photo picker accepts (the native accept attribute). |
| avatarSrc | string | - | Current avatar image; without it the avatar shows the name's initials. |
| usernamePrefix | string | "koalaui.com/" | Static prefix shown before the username input. |
| title | React.ReactNode | "Profile" | Header title. Set it and description to null to drop the header. |
| description | React.ReactNode | "This information will be displayed publicly on your profile." | Header text under the title. |
| density | "compact" | "comfortable" | "compact" | Spacing axis: compact pads 16px with sm controls, comfortable pads 24px with md controls. Falls back to the nearest DensityProvider. |