Skip to content

Add Sidebar component#89

Merged
koppen merged 5 commits intomainfrom
koppen/sidebar-component
Feb 22, 2026
Merged

Add Sidebar component#89
koppen merged 5 commits intomainfrom
koppen/sidebar-component

Conversation

@koppen
Copy link
Copy Markdown
Member

@koppen koppen commented Feb 21, 2026

Default sidebar component based on https://flowbite.com/docs/components/sidebar/

Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Adds a default Flowbite-based Sidebar component (plus navigation + item subcomponents) and wires it into the demo docs UI to replace hand-written sidebar markup.

Changes:

  • Introduces Flowbite::Sidebar, Flowbite::Sidebar::Navigation, and Flowbite::Sidebar::Item ViewComponents.
  • Adds component tests and a Lookbook preview for the new sidebar pieces.
  • Updates demo docs pages/components templates to render sidebar navigation via the new components (and updates demo dependencies / generated docs artifacts).

Reviewed changes

Copilot reviewed 8 out of 11 changed files in this pull request and generated 3 comments.

Show a summary per file
File Description
app/components/flowbite/sidebar.rb New fixed-position sidebar container component with default classes/options.
app/components/flowbite/sidebar/navigation.rb New <ul> navigation component with renders_many :items.
app/components/flowbite/sidebar/item.rb New navigation item component rendering <li><a>…</a></li> with optional icon slot.
test/components/flowbite/sidebar_test.rb Adds Minitest coverage for Sidebar, Navigation, and Item behavior/markup.
demo/test/components/previews/sidebar_preview.rb Adds a Lookbook preview showcasing the sidebar + several items/icons.
demo/app/views/docs/pages/show.html.erb Replaces hardcoded docs sidebar list with Sidebar Navigation/Item components.
demo/app/views/docs/components/show.html.erb Same as above for components docs page.
demo/Gemfile.lock Bumps local gem version and updates demo dependencies (including view_component).
demo/.yardoc/objects/root.dat New YARD-generated artifact added to demo directory.
demo/.yardoc/object_types New YARD-generated artifact added to demo directory.
demo/.yardoc/checksums New YARD-generated metadata added to demo directory.
Comments suppressed due to low confidence (4)

demo/test/components/previews/sidebar_preview.rb:63

  • This preview renders nested components via ApplicationController.render (and duplicates it in render_item/render_to_string). Other Lookbook previews in this repo render nested components directly with render(...) blocks; switching to that pattern would reduce complexity and avoid controller-level rendering in the preview.
  def render_item(component)
    ApplicationController.render(component, layout: false)
  end

  def render_to_string(component)

app/components/flowbite/sidebar.rb:37

  • The YARD type annotation for class: is listed as [Array<String>], but this component accepts a String as well (tests pass a string and Array.wrap is used). Consider changing the doc type to [String, Array<String>] to match actual usage.
    # @param class [Array<String>] Additional CSS classes for the sidebar
    #   container.
    # @param options [Hash] Additional HTML options for the sidebar container.
    def initialize(class: nil, **options)
      super()
      @class = Array.wrap(binding.local_variable_get(:class))
      @options = options

app/components/flowbite/sidebar/navigation.rb:40

  • The YARD type annotation for class: is listed as [Array<String>], but Array.wrap allows callers to pass a String too. Consider updating the doc type to [String, Array<String>] to reflect supported inputs.
      # @param class [Array<String>] Additional CSS classes for the list element.
      # @param options [Hash] Additional HTML options for the list element.
      def initialize(class: nil, **options)
        super()
        @class = Array.wrap(binding.local_variable_get(:class))
        @options = options

app/components/flowbite/sidebar/item.rb:43

  • The YARD type annotation for class: is listed as [Array<String>], but this component accepts a String as well (it uses Array.wrap). Consider updating the doc type to [String, Array<String>] to match actual usage.
      # @param class [Array<String>] Additional CSS classes for the link element.
      # @param href [String] The URL for the navigation link.
      # @param options [Hash] Additional HTML attributes for the link element.
      def initialize(href:, class: nil, **options)
        super()
        @class = Array.wrap(binding.local_variable_get(:class))
        @href = href

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

This allows us to render the navigation items in the sidebar without
needing to render the entire sidebar component, which is useful for
cases like the documentation sidebar where we want to reuse the
navigation structure but not the fixed positioning or background styles
of the full sidebar.
@koppen koppen force-pushed the koppen/sidebar-component branch from c6dd030 to 94cf21d Compare February 22, 2026 11:38
@koppen koppen changed the title Sidebar component Add Sidebar component Feb 22, 2026
@koppen koppen merged commit 44a14bc into main Feb 22, 2026
6 checks passed
@koppen koppen deleted the koppen/sidebar-component branch February 22, 2026 13:21
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants