Shadwire

Search the documentation

Search the documentation and component pages by title and by content.

Get started
Introduction
Installation
shadwire.json
Theming
Dark mode
Tools
CLI
Agent skill
Registry
llms.txt
Guides
Composition
Styling
Forms
Icons
Accessibility
Localisation
Blocks
Overview
Components
Overview
Accordion
Alert
Alert Dialog
Aspect Ratio
Avatar
Badge
Breadcrumb
Button
Button Group
Calendar
Card
Carousel
Chart
Checkbox
Collapsible
Combobox
Command
Context Menu
Data Table
Date Picker
Dialog
Drawer
Dropdown Menu
Empty
Field
Hover Card
Icon
Input
Input Group
Input OTP
Item
Kbd
Label
Menubar
Native Select
Navigation Menu
Pagination
Popover
Progress
Radio Group
Resizable
Scroll Area
Select
Separator
Sheet
Sidebar
Skeleton
Slider
Sonner
Spinner
Switch
Table
Tabs
Textarea
Toggle
Toggle Group
Tooltip

Carousel

A slide carousel with previous/next controls and arrow-key navigation.

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:

shadwire add carousel --yes

The carousel registry item installs these files:

  • app/components/ui_component.rb
  • app/components/ui/carousel_component.rb
  • app/components/ui/carousel/content_component.rb
  • app/components/ui/carousel/item_component.rb
  • app/components/ui/carousel/previous_component.rb
  • app/components/ui/carousel/next_component.rb
  • app/helpers/ui/carousel_helper.rb
  • app/javascript/controllers/ui_carousel_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

<%= ui_carousel do %>
  <%= ui_carousel_content do %>
    <%= ui_carousel_item { "Slide 1" } %>
    <%= ui_carousel_item { "Slide 2" } %>
  <% end %>
  <%= ui_carousel_previous %>
  <%= ui_carousel_next %>
<% end %>

Examples

API reference

Every part accepts class / class_name and **attrs.

Component Argument Default Description
Carousel orientation :horizontal :horizontal or :vertical; give ui_carousel_content the same value.
Carousel::Content orientation :horizontal The carousel's orientation:, repeated.