Class: Shadcn::Drawer::Component
- Inherits:
-
ApplicationViewComponent
- Object
- ViewComponent::Base
- ApplicationViewComponent
- Shadcn::Drawer::Component
- Includes:
- Concerns::ModalRoot
- Defined in:
- app/components/shadcn/drawer/component.rb
Overview
Port of registry/new-york-v4/ui/drawer.tsx
vaul's Drawer.Root wraps Radix's Dialog.Root, so the open/close half of
this component is the dialog's and runs on shadcn--dialog: the focus
trap, the scroll lock, Escape, the outside click and the exit animation
are all already there and are not reimplemented. What vaul adds is the
drag, and that is shadcn--drawer, on the content — the same arrangement
the menubar has with the dropdown.
Constant Summary
Constants inherited from ApplicationViewComponent
ApplicationViewComponent::CONTENTS_STYLE, ApplicationViewComponent::VOID_TAGS
Instance Attribute Summary
Attributes inherited from ApplicationViewComponent
Instance Method Summary collapse
-
#element_attributes(**defaults) ⇒ Object
Two controllers on one element.
Methods included from Concerns::ModalRoot
#call, #dismissable?, included, #initialize
Methods inherited from ApplicationViewComponent
#call, #css_classes, default_tag, #initialize, #merged_style, #render_element, #shadcn_t, slot_name, #style_variants, #tag_name
Instance Method Details
#element_attributes(**defaults) ⇒ Object
Two controllers on one element. data-controller is one of the
attributes that replaces rather than concatenates, so the dialog's own
string has to be repeated here rather than added to.
28 29 30 |
# File 'app/components/shadcn/drawer/component.rb', line 28 def element_attributes(**defaults) super(**{ "data-controller" => "shadcn--dialog shadcn--drawer" }.merge(defaults)) end |