Class: Shadcn::Sidebar::Rail::Component

Inherits:
ApplicationViewComponent show all
Defined in:
app/components/shadcn/sidebar/rail/component.rb

Overview

SidebarRail — the thin strip along the panel's edge that toggles it, and shows a resize cursor while doing so. tabindex="-1" is upstream's: the rail duplicates the trigger, so it is deliberately out of the tab order (vendor/shadcn/ui/sidebar.tsx:282-305).

Constant Summary

Constants inherited from ApplicationViewComponent

ApplicationViewComponent::CONTENTS_STYLE, ApplicationViewComponent::VOID_TAGS

Instance Attribute Summary

Attributes inherited from ApplicationViewComponent

#attributes

Instance Method Summary collapse

Methods inherited from ApplicationViewComponent

#call, #css_classes, default_tag, #initialize, #merged_style, #render_element, #shadcn_t, slot_name, #style_variants, #tag_name

Constructor Details

This class inherits a constructor from Shadcn::ApplicationViewComponent

Instance Method Details

#element_attributes(**defaults) ⇒ Object



30
31
32
33
34
35
36
37
38
39
# File 'app/components/shadcn/sidebar/rail/component.rb', line 30

def element_attributes(**defaults)
  super(**{
    type: "button",
    "data-sidebar" => "rail",
    "aria-label" => shadcn_t("sidebar.toggle"),
    "tabindex" => "-1",
    title: shadcn_t("sidebar.toggle"),
    "data-action" => "click->shadcn--sidebar#toggle"
  }.merge(defaults))
end