Usage
Signature:
interface CAvatarElement
Typescript Import Format
//To typecheck the element APIs, import as below.
import { CAvatarElement } from "oj-c/avatar";
//For the transpiled javascript to load the element's module, import as below
import "oj-c/avatar";
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.
Attributes
-
background :"neutral"|"orange"|"green"|"teal"|"blue"|"slate"|"pink"|"purple"|"lilac"|"gray"
-
Specifies the background of the avatar.
- Default Value:
"neutral"
Supported Values:
Value Description blue
Blue background gray
Gray background green
Green background lilac
Lilac background neutral
Neutral background (default, if unspecified) orange
Orange background pink
Pink background purple
Purple background slate
Slate background teal
Teal background Names
Item Name Property background
Property change event backgroundChanged
Property 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. IconClass will have precedence over src and initials.
Names
Item Name Property iconClass
Property change event iconClassChanged
Property 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. Initials will not be displayed if src or iconClass attributes are specified. IntlConverterUtils.getInitials can be used to generate initials from first and last names in a locale-specific manner.
Names
Item Name Property initials
Property change event initialsChanged
Property 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.
- Default Value:
"square"
Supported Values:
Value Description circle
circular avatar square
square avatar (default, if unspecified) Names
Item Name Property shape
Property change event shapeChanged
Property change listener attribute (must be of type function, see Events and Listeners for additional information.) on-shape-changed
-
size :"2xs"|"xs"|"sm"|"md"|"lg"|"xl"|"2xl"
-
Specifies the size of the avatar.
- Default Value:
"md"
Supported Values:
Value Description 2xl
extra, extra large avatar 2xs
extra, extra small avatar lg
large avatar md
medium avatar (default, if unspecified) sm
small avatar xl
extra large avatar xs
extra small avatar Names
Item Name Property size
Property change event sizeChanged
Property 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. Src will have precedence over initials, but not icon.
Names
Item Name Property src
Property change event srcChanged
Property change listener attribute (must be of type function, see Events and Listeners for additional information.) on-src-changed
Methods
-
getProperty(property) : {any}
-
Retrieves the value of a property or a subproperty.
Parameters:
Name Type Description property
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 properties
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 corresponding event.
Parameters:
Name Type Description property
The property name to set. Supports dot notation for subproperty access. value
The new value to set the property to. Returns:
- Type
- void