DaisyUIComponents.Sidebar (DaisyUIComponents v0.9.3)
View SourceProvides a responsive sidebar component with toggle functionality. The sidebar can be opened or closed, and it adjusts its width accordingly. It includes slots for page content and sidebar items, as well as a toggle button.
Examples
<.sidebar id="my_sidebar">
<:page_content>
<div class="p-4">
<h1 class="text-2xl font-bold">Main Content</h1>
<p>This is the main content area.</p>
</div>
</:page_content>
<.sidebar_items>
<.sidebar_menu_title>Menu</.sidebar_menu_title>
<.sidebar_item navigate="/" icon="hero-home" text="Home" active={true} />
<.sidebar_item navigate="/about" icon="hero-information-circle" text="About" />
<.sidebar_divider />
<.sidebar_menu_title>Settings</.sidebar_menu_title>
<.sidebar_item navigate="/profile" icon="hero-user" text="Profile" />
<.sidebar_item href="/logout" method="delete" icon="hero-logout" text="Logout" />
</.sidebar_items>
</.sidebar>
Summary
Functions
Attributes
id(:string) - Defaults to"sidebar".always_open(:boolean) - Whether the sidebar is always open, even on smaller screens, defaults to false, hidding the sidebar on smaller screens. Defaults tofalse.class(:any) - Defaults tonil.- Global attributes are accepted.
Slots
page_content(required)inner_block
Attributes
class(:any) - Defaults tonil.
Attributes
class(:any) - Defaults tonil.href(:string) - Defaults tonil.navigate(:string) - Defaults tonil.method(:string) - Defaults tonil.patch(:string) - Defaults tonil.icon(:string) - Defaults tonil.active(:boolean) - Defaults tofalse.text(:string) (required)- Global attributes are accepted.
Attributes
class(:any) - Defaults tonil.
Slots
inner_block