Usage
Signature:
interface AvatarElement
Typescript Import Format
//To typecheck the element APIs, import as below.
import { AvatarElement } from "ojs/ojavatar";
//For the transpiled javascript to load the element's module, import as below
import "ojs/ojavatar";
For additional information visit:
Note: Application logic should not interact with the component's properties or invoke its methods until the BusyContext indicates that the component is ready for interaction.
Styling Classes
-
.oj-avatar-group-image
-
Use to display avatar group placeholder image instead of single person placeholder image.
Deprecated:
Since Description 12.1.0'oj-avatar-group-image' class has been deprecated. The group placeholder icon can still be shown by setting the icon-class attribute to 'oj-ux-ico-contact-group'. Example
//Group Placeholder <oj-avatar class="oj-avatar-group-image"> </oj-avatar> -
CSS Variables
-
Avatar Color CSS
-
Avatar Sizing and Display CSS
-
Avatar Font CSS
| Name | Type | Description |
|---|---|---|
--oj-avatar-bg-color |
<color> | Avatar background color |
--oj-avatar-text-color |
<color> | Avatar text color |
| Name | Type | Description |
|---|---|---|
--oj-avatar-pattern-display |
block | none | Avatar pattern display behavior. This is only supported in Redwood. |
--oj-avatar-size |
<length> | Avatar size |
--oj-avatar-border-radius |
<length> | <percentage> | Avatar border radius, only applied to the square avatar |
| Name | Type | Description |
|---|---|---|
--oj-avatar-initials-font-size |
<length> | Avatar font size for initials |
--oj-avatar-initials-font-weight |
<font_weight> | Avatar font weight for initials |
Attributes
-
background :"neutral"|"orange"|"green"|"teal"|"blue"|"slate"|"mauve"|"pink"|"purple"|"lilac"|"gray"|"red"|"forest" background :"neutral"|"orange"|"green"|"teal"|"blue"|"slate"|"pink"|"purple"|"lilac"|"gray"
-
Specifies the background of the avatar.
- Deprecated:
-
Since Description 10.0.0This value will be removed in the future. Please use other colors. - Deprecated:
-
Since Description 10.0.0This value will be removed in the future. Please use other colors. - Deprecated:
-
Since Description 10.0.0This value will be removed in the future. Please use other colors. - Default Value:
'neutral'
Supported Values:
Value Description neutralNeutral background (default, if unspecified) orangeOrange background greenGreen background tealTeal background blueBlue background slateSlate background mauveMauve background pinkPink background purplePurple background lilacLilac background grayGray background redRed background forestForest background Names
Item Name Property backgroundProperty change event backgroundChangedProperty change listener attribute (must be of type function, see Events and Listeners for additional information.) on-background-changed -
icon-class :string
-
Specifies the icon class to be displayed. If populated, src and initials will be ignored.
- Default Value:
''
Names
Item Name Property iconClassProperty change event iconClassChangedProperty change listener attribute (must be of type function, see Events and Listeners for additional information.) on-icon-class-changed -
initials :string|null
-
Specifies the initials of the avatar. Will only be displayed if the src and iconClass attributes are null. IntlConverterUtils.getInitials can be used to generate initials from first and last names in a locale-specific manner.
- Default Value:
null
Names
Item Name Property initialsProperty change event initialsChangedProperty change listener attribute (must be of type function, see Events and Listeners for additional information.) on-initials-changed -
shape :"square"|"circle"
-
Specifies the shape of the avatar. Can be square or circle.The default value of this property varies by theme.
Supported Values:
Value Description squaresquare avatar (default, if unspecified) circlecircular avatar Names
Item Name Property shapeProperty change event shapeChangedProperty change listener attribute (must be of type function, see Events and Listeners for additional information.) on-shape-changed -
size :"2xs"|"xxs"|"xs"|"sm"|"md"|"lg"|"xl"|"2xl"|"xxl" size :"2xs"|"xs"|"sm"|"md"|"lg"|"xl"|"2xl"
-
Specifies the size of the avatar.
- Deprecated:
-
Since Description 13.0.0These values will be removed in the future. Please use '2xl' or '2xs' instead. - Deprecated:
-
Since Description 13.0.0These values will be removed in the future. Please use '2xl' or '2xs' instead. - Default Value:
'md'
Supported Values:
Value Description 2xsextra, extra small avatar xxsextra, extra small avatar(deprecated) xsextra small avatar smsmall avatar mdmedium avatar (default, if unspecified) lglarge avatar xlextra large avatar 2xlextra, extra large avatar xxlextra, extra large avatar(deprecated) Names
Item Name Property sizeProperty change event sizeChangedProperty change listener attribute (must be of type function, see Events and Listeners for additional information.) on-size-changed -
src :string|null
-
Specifies the src for the image of the avatar. Image will be rendered as a background image. Will be ignored if iconClass is populated.
- Default Value:
null
Names
Item Name Property srcProperty change event srcChangedProperty change listener attribute (must be of type function, see Events and Listeners for additional information.) on-src-changed
Methods
-
getProperty(property) : {any}
-
Retrieves a value for a property or a single subproperty for complex properties.
Parameters:
Name Type Description propertystring The property name to get. Supports dot notation for subproperty access. Returns:
- Type
- any
-
setProperties(properties) : {void}
-
Performs a batch set of properties.
Parameters:
Name Type Description propertiesObject An object containing the property and value pairs to set. Returns:
- Type
- void
-
setProperty(property, value) : {void}
-
Sets a property or a single subproperty for complex properties and notifies the component of the change, triggering a [property]Changed event.
Parameters:
Name Type Description propertystring The property name to set. Supports dot notation for subproperty access. valueany The new value to set the property to. Returns:
- Type
- void