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 blueBlue background grayGray background greenGreen background lilacLilac background neutralNeutral background (default, if unspecified) orangeOrange background pinkPink background purplePurple background slateSlate background tealTeal 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. IconClass will have precedence over src and initials.
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. 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 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.
- Default Value:
"square"
Supported Values:
Value Description circlecircular avatar squaresquare avatar (default, if unspecified) 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"|"xs"|"sm"|"md"|"lg"|"xl"|"2xl"
-
Specifies the size of the avatar.
- Default Value:
"md"
Supported Values:
Value Description 2xlextra, extra large avatar 2xsextra, extra small avatar lglarge avatar mdmedium avatar (default, if unspecified) smsmall avatar xlextra large avatar xsextra small avatar 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. Src will have precedence over initials, but not icon.
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 the value of a property or a subproperty.
Parameters:
Name Type Description propertyThe 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 propertiesAn 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 propertyThe property name to set. Supports dot notation for subproperty access. valueThe new value to set the property to. Returns:
- Type
- void