Avatar displays a user's picture. This helps aid easy recognition of the user. This kit is normally not used by itself, but rather used within other kits.
The only time Avatar should be used instead of the User kit is when you are not going to display the user's name.
<%= pb_rails("avatar", props: { name: "Terry Johnson", size: "xxs", image_url: "https://randomuser.me/api/portraits/men/44.jpg", status: "away" }) %> <br> <%= pb_rails("avatar", props: { name: "Terry Johnson", size: "xs", image_alt: "Terry Johnson Standing", image_url: "https://randomuser.me/api/portraits/men/44.jpg", status: "online" }) %> <br> <%= pb_rails("avatar", props: { name: "Terry Johnson", size: "sm", image_alt: "Terry Johnson Standing", image_url: "https://randomuser.me/api/portraits/men/44.jpg", status: "away" }) %> <br> <%= pb_rails("avatar", props: { name: "Terry Johnson", size: "md", image_alt: "Terry Johnson Standing", image_url: "https://randomuser.me/api/portraits/men/44.jpg", status: "offline" }) %> <br> <%= pb_rails("avatar", props: { name: "Terry Johnson", size: "lg", image_alt: "Terry Johnson Standing", image_url: "https://randomuser.me/api/portraits/men/44.jpg", status: "online" }) %> <br> <%= pb_rails("avatar", props: { name: "Terry Johnson", size: "xl", image_alt: "Terry Johnson Standing", image_url: "https://randomuser.me/api/portraits/men/44.jpg", status: "away" }) %>
This is used when there is no avatar for a particular user.
<%= pb_rails("avatar", props: { name: "Terry Johnson", size: "xxs" }) %> <%= pb_rails("avatar", props: { name: "Terry Johnson", size: "xs" }) %> <%= pb_rails("avatar", props: { name: "Terry Johnson", size: "sm" }) %> <%= pb_rails("avatar", props: { name: "Terry Johnson", size: "md" }) %> <%= pb_rails("avatar", props: { name: "Terry Johnson", size: "lg" }) %> <%= pb_rails("avatar", props: { name: "Terry Johnson", size: "xl" }) %>
A monagram is used as a fallback when an invalid or missing image url is provided.
<%= pb_rails("avatar", props: { image_url: "", name: "Terry Johnson", size: "xxs" }) %> <%= pb_rails("avatar", props: { image_url: true, name: "Terry Johnson", size: "xs" }) %> <%= pb_rails("avatar", props: { image_url: 4, name: "Terry Johnson", size: "sm" }) %> <%= pb_rails("avatar", props: { image_url: "https://google.com", name: "Terry Johnson", size: "md" }) %> <%= pb_rails("avatar", props: { image_url: "", name: "Terry Johnson", size: "lg" }) %> <%= pb_rails("avatar", props: { image_url: "https://randomuser.me/api/portraits/men/notapicture.jpg", name: "Terry Johnson", size: "xl" }) %>
The Status prop is used to display a user's online status like popular chat apps.
<%= pb_rails("avatar", props: { name: "Terry Johnson", size: "sm", image_alt: "Terry Johnson Status", image_url: "https://randomuser.me/api/portraits/men/44.jpg" }) %> <br> <%= pb_rails("avatar", props: { name: "Terry Johnson", size: "sm", image_alt: "Terry Johnson Online", image_url: "https://randomuser.me/api/portraits/men/44.jpg", status: "online" }) %> <br> <%= pb_rails("avatar", props: { name: "Terry Johnson", size: "sm", image_alt: "Terry Johnson Away", image_url: "https://randomuser.me/api/portraits/men/44.jpg", status: "away" }) %> <br> <%= pb_rails("avatar", props: { name: "Terry Johnson", size: "sm", image_alt: "Terry Johnson Offline", image_url: "https://randomuser.me/api/portraits/men/44.jpg", status: "offline" }) %>
NOTE: All componentOverlay implementations require a placement prop, that accepts any of the following values: top-right, top-left, bottom-right, bottom-left, top-center, bottom-center, left-center, and right-center.
When passing the iconCircle component as an overlay, you must also specify an icon, and you may optionally control the color by passing an approved value as a variant.
<%= pb_rails("avatar", props: { component_overlay: { component: "icon_circle", icon: "shield", placement: "bottom-right", variant: "royal" }, name: "Terry Johnson", size: "sm", image_url: "https://randomuser.me/api/portraits/men/44.jpg", margin_bottom: "sm" }) %> <%= pb_rails("avatar", props: { component_overlay: { component: "icon_circle", icon: "check", placement: "top-right", variant: "green" }, name: "Terry Johnson", size: "md", image_url: "https://randomuser.me/api/portraits/men/44.jpg", margin_bottom: "sm" }) %> <%= pb_rails("avatar", props: { component_overlay: { component: "icon_circle", icon: "lock", placement: "top-left", variant: "red" }, name: "Terry Johnson", size: "lg", image_url: "https://randomuser.me/api/portraits/men/44.jpg", margin_bottom: "sm" }) %> <%= pb_rails("avatar", props: { component_overlay: { component: "icon_circle", icon: "star", placement: "left-center", variant: "yellow" }, name: "Terry Johnson", size: "xl", image_url: "https://randomuser.me/api/portraits/men/44.jpg", margin_bottom: "sm" }) %>
NOTE: All componentOverlay implementations require a placement prop, that accepts any of the following values: top-right, top-left, bottom-right, bottom-left, top-center, bottom-center, left-center, and right-center.
When passing the badge component as an overlay, you must also specify its text content,and you may optionally control the color by passing an approved value as a variant.
<%= pb_rails("avatar", props: { component_overlay: { component: "badge", text: "12", placement: "bottom-right" }, name: "Terry Johnson", size: "sm", image_url: "https://randomuser.me/api/portraits/men/44.jpg", margin_bottom: "sm" }) %> <%= pb_rails("avatar", props: { component_overlay: { component: "badge", text: "12", placement: "top-left" }, name: "Terry Johnson", size: "md", image_url: "https://randomuser.me/api/portraits/men/44.jpg", margin_bottom: "sm" }) %> <%= pb_rails("avatar", props: { component_overlay: { component: "badge", text: "On Roadtrip", placement: "top-center", variant: "info" }, name: "Terry Johnson", size: "lg", image_url: "https://randomuser.me/api/portraits/men/44.jpg", margin_bottom: "sm" }) %> <%= pb_rails("avatar", props: { component_overlay: { component: "badge", text: "Out of Office", placement: "bottom-center", variant: "error" }, name: "Terry Johnson", size: "xl", image_url: "https://randomuser.me/api/portraits/men/44.jpg", margin_bottom: "sm" }) %>
Avoid using Avatar with the user's name right next to it or under it. Use User kit instead. Do not use this kit for images that are not profile pictures.
| Props | Type | Values |
|---|---|---|
align_content |
enum | responsive
|
start
end
center
spaceBetween
spaceAround
spaceEvenly
|
align_items |
enum | responsive
|
start
end
center
|
border_radius |
enum
|
none
xs
sm
md
lg
xl
rounded
|
cursor |
enum
|
auto
default
none
contextMenu
help
pointer
progress
wait
cell
|
dark |
boolean
|
true
false
|
flex |
enum | responsive
|
auto
initial
0
1
2
3
4
5
6
7
8
9
10
11
12
none
|
flex_direction |
enum | responsive
|
row
column
rowReverse
columnReverse
|
flex_wrap |
enum | responsive
|
wrap
nowrap
wrapReverse
|
justify_content |
enum | responsive
|
start
end
center
spaceBetween
spaceAround
spaceEvenly
|
line_height |
enum
|
loosest
looser
loose
normal
tight
tighter
tightest
|
margin_right |
array
|
none
xxs
xs
sm
md
lg
xl
|
margin_left |
array
|
none
xxs
xs
sm
md
lg
xl
|
margin_top |
array
|
none
xxs
xs
sm
md
lg
xl
|
margin_bottom |
array
|
none
xxs
xs
sm
md
lg
xl
|
margin_x |
array
|
none
xxs
xs
sm
md
lg
xl
|
margin_y |
array
|
none
xxs
xs
sm
md
lg
xl
|
margin |
array
|
none
xxs
xs
sm
md
lg
xl
|
width |
string
|
|
min_width |
string
|
|
max_width |
string
|
|
gap |
string | responsive
|
|
column_gap |
string | responsive
|
|
row_gap |
string | responsive
|
|
number_spacing |
enum
|
tabular
|
order |
enum | responsive
|
none
first
1
2
3
4
5
6
7
8
9
10
11
12
|
overflow_x |
enum
|
scroll
visible
hidden
auto
|
overflow_y |
enum
|
scroll
visible
hidden
auto
|
overflow |
enum
|
scroll
visible
hidden
auto
|
padding_right |
array
|
none
xxs
xs
sm
md
lg
xl
|
padding_left |
array
|
none
xxs
xs
sm
md
lg
xl
|
padding_top |
array
|
none
xxs
xs
sm
md
lg
xl
|
padding_bottom |
array
|
none
xxs
xs
sm
md
lg
xl
|
padding_x |
array
|
none
xxs
xs
sm
md
lg
xl
|
padding_y |
array
|
none
xxs
xs
sm
md
lg
xl
|
padding |
array
|
none
xxs
xs
sm
md
lg
xl
|
position |
enum
|
relative
absolute
fixed
sticky
static
|
shadow |
enum
|
none
deep
deeper
deepest
|
text_align |
enum | responsive
|
start
end
left
right
center
justify
justifyAll
matchParent
|
truncate |
enum
|
none
1
2
3
4
5
|
vertical_align |
enum | responsive
|
baseline
super
top
middle
bottom
sub
text-top
text-bottom
|
z_index |
enum | responsive
|
1
2
3
4
5
6
7
8
9
10
max
|
top |
enum | object
|
xxs
xs
sm
md
lg
xl
xxl
|
inset |
boolean
|
true
false
|
right |
enum | object
|
xxs
xs
sm
md
lg
xl
xxl
|
bottom |
enum | object
|
xxs
xs
sm
md
lg
xl
xxl
|
left |
enum | object
|
xxs
xs
sm
md
lg
xl
xxl
|
height |
string
|
|
max_height |
string
|
|
min_height |
string
|
|
hover |
object
|
|
group_hover |
boolean
|
true
false
|
| Props | Type | Values | Default |
|---|---|---|---|
grayscale |
boolean
|
true
false
|
false
|
image_alt |
string
|
||
image_url |
string
|
||
name |
string
|
||
size |
enum
|
md
lg
sm
xl
xs
xxs
|
md
|
status |
enum
|
away
offline
online
|
|
component_overlay |
string
|