Flowbite::Sidebar::Item

Renders a sidebar navigation item.

Each item renders as a list item containing a link. Optionally, an icon can be provided using the +icon+ slot, which will be displayed before the label text.

Basic item

<%= render Flowbite::Sidebar::Item.new(href: "/dashboard") { "Dashboard" } %>

Item with icon

<%= render(Flowbite::Sidebar::Item.new(href: "/dashboard")) do |item| %>
  <% item.with_icon do %>
    <svg class="w-5 h-5" ...>...</svg>
  <% end %>
  Dashboard
<% end %>

API reference

Inherits from Flowbite::Sidebar

Slots

icon An optional icon displayed before the label text.

Constructor

def initialize(href:, class: nil, **options)

Parameters

class Array<String> Additional CSS classes for the link element.
href String The URL for the navigation link.
options Hash Additional HTML attributes for the link element.

See also

Ruby API documentation for class Flowbite::Sidebar::Item