Dropdown
The dropdown component creates accessible dropdown menus with automatic positioning using Floating UI.Basic Usage
Features
- Automatic positioning - Uses Floating UI to position the menu optimally
- Auto-flip - Menu flips to stay within viewport
- Click outside to close - Menu closes when clicking outside
- Escape to close - Menu closes when pressing Escape key
- Keyboard navigation - Full keyboard accessibility
dropdown
Creates the dropdown container with Stimulus controller.
dropdown_toggle
Creates the button that toggles the dropdown menu.
dropdown_menu
Creates the menu container for dropdown items.
Complete Example
Dialog
Dialogs (modals) are used for focused interactions that require user attention. They overlay the page content and must be dismissed before continuing.Basic Usage
dialog_header
Creates a dialog header with title and close button.
Renders:
dialog_close_button
Creates a standalone close button for dialogs.
dialog_discard_button
Creates a “Discard” button that closes the dialog.
Renders:
Complete Dialog Example
Drawer
Drawers are slide-out panels typically used for filters, secondary forms, or detailed views without leaving the current page.Basic Usage
drawer_header
Creates a drawer header with title and close button.
Renders:
drawer_close_button
Creates a standalone close button for drawers.
drawer_discard_button
Creates a “Discard” button that closes the drawer.
Icon
Icons are rendered using the Tabler Icons library.Basic Usage
Options
Output
Legacy Icon Names
For backwards compatibility, legacy icon names are automatically translated:Common Icons
Image
Displays optimized images with automatic WebP conversion and retina support.Basic Usage
Options
Features
- Retina support - Automatically scales dimensions by 2x for sharp display
- WebP conversion - Outputs optimized WebP format
- Smart cropping - When both dimensions provided, crops to fill
- Aspect ratio preservation - When one dimension provided, maintains ratio
Examples
With Placeholder
For comprehensive documentation on image handling, storage configuration, and best practices, see the Media guide.
Tooltip
Tooltips provide additional context on hover.Basic Usage
tooltip
Creates a tooltip container.
help_bubble
Creates an info icon with a tooltip - commonly used for form field hints.
Output:
Active Badge
Displays a status badge indicating active/inactive state.Basic Usage
Options
Output
When condition istrue:
false:
Custom Labels
Avatar
Renders a user avatar with automatic fallback to initials.Basic Usage
Options
Behavior
- If user has an attached avatar image → displays the image
- Otherwise → displays user’s initials on a colored background
Clipboard
Copy-to-clipboard functionality with visual feedback.Basic Usage
clipboard_component
Creates a complete clipboard component with hidden input and copy button.
Output:
clipboard_button
Creates just the copy button (for custom layouts).
Inline with Text
Progress Bar
Displays a progress bar with customizable range.Basic Usage
Options
Output
Examples
Date & Time
Helpers for displaying dates and times in the user’s local timezone.spree_date
Renders a date in the user’s local format.
spree_time
Renders a date and time in the user’s local format.
spree_time_ago
Renders a relative time (e.g., “2 hours ago”) with a tooltip showing the full timestamp.
local_time
The underlying helper from local_time gem - displays time in user’s browser timezone.
Comparison
Best Practices
Use semantic components - Choose the right component for the interaction (Dialog for focused tasks, Drawer for contextual panels)
Provide feedback - Use tooltips and badges to give users context about their actions
Keep dropdowns focused - Limit dropdown menus to related actions, use dividers to group items
Use appropriate icons - Choose icons that clearly represent the action
Handle loading states - Use
turbo_save_button_tag for forms to show loading feedbackConsider accessibility - Components include ARIA attributes and keyboard navigation

