x
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
<div class="max-w-4xl mx-auto p-6"> <h2 class="text-xl font-bold mb-4">Hoverable Table</h2> <p class="text-sm text-grayscale-500 mb-4">Hover over the rows to see the highlight effect.</p> <div class="shadow-sm ring-1 ring-black/5 sm:rounded-lg overflow-x-auto"> <table class="min-w-full divide-y divide-info-300"> <thead class="bg-info-50 text-info-900"> <tr class=""> <th class="px-3 py-3.5 text-sm font-semibold align-middle text-left first:ps-4 first:pe-3 sm:first:ps-6 last:ps-3 last:pe-4 sm:last:pe-6" scope="col" > Order # </th> <th class="px-3 py-3.5 text-sm font-semibold align-middle text-left first:ps-4 first:pe-3 sm:first:ps-6 last:ps-3 last:pe-4 sm:last:pe-6" scope="col" > Customer </th> <th class="px-3 py-3.5 text-sm font-semibold align-middle text-left first:ps-4 first:pe-3 sm:first:ps-6 last:ps-3 last:pe-4 sm:last:pe-6" scope="col" > Date </th> <th class="px-3 py-3.5 text-sm font-semibold align-middle text-right first:ps-4 first:pe-3 sm:first:ps-6 last:ps-3 last:pe-4 sm:last:pe-6" scope="col" > Total </th> </tr> </thead> <tbody class="divide-y divide-info-200 bg-white"> <tr class="hover:bg-info-100 transition-colors"> <td class="px-3 py-4 text-sm text-black align-middle text-left first:ps-4 first:pe-3 sm:first:ps-6 last:ps-3 last:pe-4 sm:last:pe-6" > ORD-001 </td> <td class="px-3 py-4 text-sm text-black align-middle text-left first:ps-4 first:pe-3 sm:first:ps-6 last:ps-3 last:pe-4 sm:last:pe-6" > Alice Johnson </td> <td class="px-3 py-4 text-sm text-black align-middle text-left first:ps-4 first:pe-3 sm:first:ps-6 last:ps-3 last:pe-4 sm:last:pe-6" > 2024-01-15 </td> <td class="px-3 py-4 text-sm text-black align-middle text-right first:ps-4 first:pe-3 sm:first:ps-6 last:ps-3 last:pe-4 sm:last:pe-6" > $299.00 </td> </tr> <tr class="hover:bg-info-100 transition-colors"> <td class="px-3 py-4 text-sm text-black align-middle text-left first:ps-4 first:pe-3 sm:first:ps-6 last:ps-3 last:pe-4 sm:last:pe-6" > ORD-002 </td> <td class="px-3 py-4 text-sm text-black align-middle text-left first:ps-4 first:pe-3 sm:first:ps-6 last:ps-3 last:pe-4 sm:last:pe-6" > Bob Smith </td> <td class="px-3 py-4 text-sm text-black align-middle text-left first:ps-4 first:pe-3 sm:first:ps-6 last:ps-3 last:pe-4 sm:last:pe-6" > 2024-01-16 </td> <td class="px-3 py-4 text-sm text-black align-middle text-right first:ps-4 first:pe-3 sm:first:ps-6 last:ps-3 last:pe-4 sm:last:pe-6" > $149.50 </td> </tr> <tr class="hover:bg-info-100 transition-colors"> <td class="px-3 py-4 text-sm text-black align-middle text-left first:ps-4 first:pe-3 sm:first:ps-6 last:ps-3 last:pe-4 sm:last:pe-6" > ORD-003 </td> <td class="px-3 py-4 text-sm text-black align-middle text-left first:ps-4 first:pe-3 sm:first:ps-6 last:ps-3 last:pe-4 sm:last:pe-6" > Charlie Brown </td> <td class="px-3 py-4 text-sm text-black align-middle text-left first:ps-4 first:pe-3 sm:first:ps-6 last:ps-3 last:pe-4 sm:last:pe-6" > 2024-01-17 </td> <td class="px-3 py-4 text-sm text-black align-middle text-right first:ps-4 first:pe-3 sm:first:ps-6 last:ps-3 last:pe-4 sm:last:pe-6" > $75.25 </td> </tr> <tr class="hover:bg-info-100 transition-colors"> <td class="px-3 py-4 text-sm text-black align-middle text-left first:ps-4 first:pe-3 sm:first:ps-6 last:ps-3 last:pe-4 sm:last:pe-6" > ORD-004 </td> <td class="px-3 py-4 text-sm text-black align-middle text-left first:ps-4 first:pe-3 sm:first:ps-6 last:ps-3 last:pe-4 sm:last:pe-6" > Diana Prince </td> <td class="px-3 py-4 text-sm text-black align-middle text-left first:ps-4 first:pe-3 sm:first:ps-6 last:ps-3 last:pe-4 sm:last:pe-6" > 2024-01-18 </td> <td class="px-3 py-4 text-sm text-black align-middle text-right first:ps-4 first:pe-3 sm:first:ps-6 last:ps-3 last:pe-4 sm:last:pe-6" > $512.00 </td> </tr> </tbody> </table> </div></div>1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
<div class="max-w-4xl mx-auto p-6"> <h2 class="text-xl font-bold mb-4">Hoverable Table</h2> <p class="text-sm text-grayscale-500 mb-4">Hover over the rows to see the highlight effect.</p> <%= render BetterUi::Table::TableComponent.new(variant: :info, hoverable: true) do |t| %> <% t.with_header do |h| %> <% h.with_cell(label: "Order #") %> <% h.with_cell(label: "Customer") %> <% h.with_cell(label: "Date") %> <% h.with_cell(label: "Total", align: :right) %> <% end %> <% [ ["ORD-001", "Alice Johnson", "2024-01-15", "$299.00"], ["ORD-002", "Bob Smith", "2024-01-16", "$149.50"], ["ORD-003", "Charlie Brown", "2024-01-17", "$75.25"], ["ORD-004", "Diana Prince", "2024-01-18", "$512.00"] ].each do |row_data| %> <% t.with_row do |r| %> <% r.with_cell { row_data[0] } %> <% r.with_cell { row_data[1] } %> <% r.with_cell { row_data[2] } %> <% r.with_cell(align: :right) { row_data[3] } %> <% end %> <% end %> <% end %></div>No notes provided.
No params configured.