Avatar
Modifier | DaisyUI class |
---|---|
:online | online |
:offline | offline |
:placeholder | placeholder |
# Avatar
1 Avatar do 2 div class: "w-24 rounded" do 3 img src: 4 end 5end
# Avatar in custom sizes
1 ["w-32", "w-20", "w-16", "w-8"].each do |width| 2 Avatar do 3 div class: "rounded #{width}" do 4 img src:, alt: 5 end 6end
7end
# Avatar rounded
1 Avatar do 2 div class: "w-24 rounded-xl" do 3 img src:, alt: 4 end 5end
6 7 Avatar do 8 div class: "w-24 rounded-full" do 9 img src:, alt: 10 end 11end
# Avatar with mask
1 Avatar do 2 Mask :squircle, class: "w-24" do 3 img src:, alt: 4 end 5end
6 7 Avatar do 8 Mask :hexagon, class: "w-24" do 9 img src:, alt: 10 end 11end
12 13 Avatar do 14 Mask :triangle, class: "w-24" do 15 img src:, alt: 16 end 17end
# Avatar group
1 AvatarGroup class: "-space-x-6 rtl:space-x-reverse" do |avatar_group| 2 4.times do 3 avatar_group.avatar do 4 div class: "w-12" do 5 img src:, alt: 6 end 7end
8end
9end
# Avatar group with counter
1 AvatarGroup class: "-space-x-6 rtl:space-x-reverse" do |avatar_group| 2 3.times do 3 avatar_group.avatar do 4 div class: "w-12" do 5 img src:, alt: 6 end 7end
8end
9 10 avatar_group.avatar :placeholder do 11 div class: "w-12 bg-neutral text-neutral-content" do 12 span do 13"+99"
14end
15end
16end
17end
+99
# Avatar with ring
1 Avatar do 2 classes = [ 3 "w-24", 4 "rounded-full", 5 "ring", 6 "ring-primary", 7 "ring-offset-base-100", 8"ring-offset-2"
9]
10 11 div class: classes do 12 img src:, alt: 13 end 14end
# Avatar with presence indicator
1 Avatar :online do 2 div class: "w-24 rounded-full" do 3 img src:, alt: 4 end 5end
6 7 Avatar :offline do 8 div class: "w-24 rounded-full" do 9 img src:, alt: 10 end 11end
# Avatar placeholder
1 base_classes = [ 2 "rounded-full", 3 "bg-neutral", 4"text-neutral-content"
5]
6 7 Avatar :placeholder do 8 div class: [*base_classes, "w-24"] do 9 span class: "text-3xl" do 10"D"
11end
12end
13end
14 15 Avatar :placeholder, :online do 16 div class: [*base_classes, "w-16"] do 17 span class: "text-xl" do 18"AI"
19end
20end
21end
22 23 Avatar :placeholder do 24 div class: [*base_classes, "w-12"] do 25 span do 26"SY"
27end
28end
29end
30 31 Avatar :placeholder do 32 div class: [*base_classes, "w-8"] do 33 span class: "text-xs" do 34"UI"
35end
36end
37end
D
AI
SY
UI