Collapsible
A section that expands and collapses, driven by the ui-collapsible controller.
Installation
Shadwire follows shadcn/ui's open code model: the component's source is copied into your application and becomes yours. Install it with the CLI:
The collapsible registry item installs these files:
-
app/components/ui_component.rb -
app/components/ui/collapsible_component.rb -
app/components/ui/collapsible/trigger_component.rb -
app/components/ui/collapsible/content_component.rb -
app/helpers/ui/collapsible_helper.rb -
app/javascript/controllers/ui_collapsible_controller.js -
vendor/shadwire/shadwire.css
This component uses Stimulus, so the application needs importmap-rails and stimulus-rails with automatic controller loading.
Haven't installed the CLI yet? gem install shadwire, then shadwire init.
Usage
Examples
Default
A list that reveals additional items.
@shadwire has 3 repositories
@shadwire/ui
@shadwire/registry
@shadwire/cli
API reference
Every part accepts class / class_name and **attrs.
| Component | Argument | Default | Description |
|---|---|---|---|
Collapsible |
open |
false |
Starts open. |
Collapsible::Trigger |
open |
false |
Give it the root's open: too, so the server already renders the right aria-expanded. |
Collapsible::Content |
open |
false |
Give it the root's open: too, so it is not hidden until the controller connects. |