UNPKG

@navinc/base-react-components

Version:
17 lines (14 loc) 1.07 kB
This component displays an Avatar with optional string label. The avatar image has a rounded square container. ## Props - **src** (img src): displays an `img`. - Without "src" it will fallback to label abbreviations or an icon, on a grey background - image is always centered horizontally and vertically - the image is never skewed and always fits 100% width. Try to use square images. - if there is a source, the background is transparent - **defaultIcon** (IconName): overrides the final fallback icon on a grey background if no image src or label is provided - **label** (string): displays a `p` beside the avatar image, the avatar image will add margins. - The label is the 2nd avatar fallback if no src is provided. - The avatar label fallback is an abbreviation of the first and last words of the label, eg: Jack Daniels Whisky -> JW - if the label is only 1 word, it will use the first 2 characters, ie: Jack -> JA - **size** (string): one of "medium" (32px), "large" (50px) - **alt** (string): replaces default alt string for accessibility