Skip to main content

Avatar

A compact control for uploading an avatar to a form.

Avatar form control with an empty photo placeholder and an Add a photo prompt in DHTMLX Suite

Related sample: Form. All controls

Related sample: Form. Avatar

Adding Avatar​

You can add an Avatar control during form initialization:

const form = new dhx.Form("form_container", {
rows: [
{
type: "avatar",
name: "avatar",
required: true,
labelWidth: 140,
label: "Employee photo",
labelPosition: "top",
placeholder: "Add a photo",
value: {
src: "https://server.domain/upload/image.jpg"
}
}
]
});

Properties​

View the full list of Avatar configuration properties.

Working with Avatar​

You can manage an Avatar control with the methods and events of the object that the getItem() method returns.

For example, you can get the value of the control:

const value = form.getItem("avatar").getValue();

Methods​

Check the full list of Avatar methods.

Events​

Check the full list of Avatar events.