2.0.3 • Published 2 months ago

@fw-components/fw-avatar v2.0.3

Weekly downloads
-
License
ISC
Repository
-
Last release
2 months ago

fw-avatar-group

FW Avatar Group component is used to show a list of items as avatars. It also displays a detailed list on clicking any avatar.

Installation

npm i @fw-components/fw-avatar

Example usage

let users = [{name: "Richard", company: "PiedPiper"},{name: "Dinesh", company: "PiedPiper"},{name: "Jared", company: "PiedPiper"}]
<fw-avatar-group .items=${users} nameAttribute="name" secondaryAttribute="company"></fw-avatar-group>

API

Properties/Attributes

NameTypeDefaultDescription
itemsArray[]data as Array of objects
nameAttributeString"userName"key in item used to display initials on avatar and title on list
secondaryAttributeStringnullkey in item used to display secondary line for the item in the list
maxCountNumber5max count of avatars to be displayed in the group
headerString"Members"header of the list
avatarBackgroundStringcustom hsl for itemnameAttributebackground for the avatar
primaryAction*Objectnullaction to be displayed on top of list
showSearchBarBooleanfalseshow search bar for the items
emptyStateMessageStringnullmessage to be displayed when state is empty while searching
emptyStateAction**Objectnullaction to be displayed when state is empty while searching
secondaryAction**Objectnullaction to be displayed at bottom of list
absoluteBooleanfalseif true, list is positioned absolute on devices with width < 767px

*primaryAction => {title : 'Title for the action button', icon : 'mwc-icon to show next to button, default to add_circle'}

**empty state/secondary action => {title : 'Title for the action button', closeDialog : 'boolean to close the dialog on click'}

Methods

None

Events

Event NameDetailDescription
item-clicked{ item }Fired when an item is clicked from the list, includes the item as detail
primary-action-clickednullFired when primary action is clicked
secondary-action-clickednullFired when secondary action is clicked
empty-state-action-clicked{ value : "search bar value" }Fired when empty state action is clicked, includes value in the search bar as detail

CSS Custom Properties

fw-avatar-group uses fw-avatar internally

Global Custom Properties

NameDescription
dark-colorcolor of text on avatar
light-colorborder of overlapping avatar

fw-avatar

FW Avatar component is used to show an avatar

Installation

npm i @fw-components/fw-avatar

Example usage

<fw-avatar type="initials" name="Richard Hendricks"></fw-avatar>

API

Properties/Attributes

NameTypeDefaultDescription
nameStringnullname used for initials
titleStringnametitle visible on hover, defaults to name
typeStringnonetype of avatar initials/image
colorStringcustom hsl for name or 'plum'color of avatar
imgSrcStringnullsrc of image when type of avatar is image

Methods

None

Events

None

CSS Custom Properties

NameDefaultDescription
avatar-colorwhitetext color on avatar
avatar-size30pxsize of avatar
bordernoneborder of avatar

Global Custom Properties

NameDescription
font-familyfont-family for text on avatar
2.0.3

2 months ago

2.0.2

4 months ago

1.0.2

9 months ago

1.0.1

9 months ago

1.0.0

9 months ago

2.0.2-trackers.0

4 months ago

1.0.6

9 months ago

1.0.5

9 months ago

1.0.4

9 months ago

0.0.0-actions.0

9 months ago

1.0.3

9 months ago

0.0.0-actions.1

9 months ago

0.0.1-alpha.0

9 months ago

0.0.1-alpha.1

9 months ago

2.0.1

9 months ago

2.0.0

9 months ago

0.0.0-alpha.1

12 months ago

0.0.0-alpha.0

12 months ago