Navbar
Modifier | DaisyUI class |
---|---|
:primary | bg-primary text-primary-content |
:secondary | bg-secondary text-secondary-content |
:accent | bg-accent text-accent-content |
:neutral | bg-neutral text-neutral-content |
:base_100 | bg-base-100 text-base-content |
:base_200 | bg-base-200 text-base-content |
:base_300 | bg-base-300 text-base-content |
:info | bg-info text-info-content |
:success | bg-success text-success-content |
:warning | bg-warning text-warning-content |
:error | bg-error text-error-content |
# Navbar
1 Navbar :base_100, class: "shadow-xl rounded-box" do 2 Button :ghost, class: "text-xl" do 3"daisyUI"
4end
5end
# Navbar with title and icon
1 Navbar :base_100, class: "shadow-xl rounded-box" do |navbar| 2 navbar.start do 3 Button :ghost, class: "text-xl" do 4"daisyUI"
5end
6end
7 8 navbar.end do 9 Button :square, :ghost do 10three_dots_svg
11end
12end
13end
# Navbar with icons at start and end
1 Navbar :base_100, class: "shadow-xl rounded-box" do |navbar| 2 navbar.start do 3 Button :square, :ghost do 4hamburger_svg
5end
6 Button :ghost, class: "text-xl" do 7"daisyUI"
8end
9end
10 11 navbar.end do 12 Button :square, :ghost do 13three_dots_svg
14end
15end
16end
# Navbar with menu and submenu
1 Navbar :base_100, class: "shadow-xl rounded-box" do |navbar| 2 navbar.start do 3 Button :ghost, class: "text-xl" do 4"daisyUI"
5end
6end
7 8 navbar.end do 9 Menu :horizontal, class: "px-1" do |menu| 10 menu.item do 11 Link do 12"Link"
13end
14end
15 16 menu.item do |item| 17 item.submenu( 18 :collapsible, 19 :base_100, 20 class: "rounded-t-none p-2" 21 ) do |submenu| 22 submenu.title do 23 Link do 24"Parent"
25end
26end
27 28 submenu.item do 29 Link do 30"Link 1"
31end
32end
33 submenu.item do 34 Link do 35"Link 2"
36end
37end
38end
39end
40end
41end
42end
# Navbar with search input and dropdown
1 Navbar :base_100, class: "shadow-xl rounded-box" do |navbar| 2 navbar.start do 3 Button :ghost, class: "text-xl" do 4"daisyUI"
5end
6end
7 8 navbar.end class: "gap-2" do 9 FormControl do 10 input type: "text", placeholder: "Search", class: "input input-bordered w-24 md:w-auto" 11end
12 13 Dropdown :end do |dropdown| 14 dropdown.button :ghost, :circle, class: "avatar" do 15 div class: "w-10 rounded-full" do 16 img src:, alt: "Tailwind CSS Navbar component" 17end
18end
19 20 dropdown.menu :base_100, :sm, class: "rounded-box z-[1] mt-3 w-52 p-2 shadow" do |menu| 21 menu.item do 22 Link class: "justify-between" do 23 plain "Profile" 24 Badge :secondary do 25"New"
26end
27end
28end
29 menu.item do 30 Link do 31"Settings"
32end
33end
34 menu.item do 35 Link do 36"Logout"
37end
38end
39end
40end
41end
42end