For UI components that render HTML elements (Dropdowns, Dialogs, Icons, etc.), see the Components documentation.
Navigation Helpers
nav_item
Creates a navigation item with optional icon.
| Option | Type | Description |
|---|---|---|
label | String | The text to display |
url | String | The URL for the link (required) |
icon | String | Icon name to prepend |
active | Boolean | Force active state |
data | Hash | Data attributes |
link_to_with_icon
Creates a link with an icon.
| Parameter | Type | Description |
|---|---|---|
icon_name | String | Icon name from Tabler Icons |
text | String | Link text |
url | String | Link URL (use spree. routes for internal links) |
no_text | Boolean | Show only icon with text as tooltip |
title | String | Tooltip text |
active_link_to_with_icon
Same as link_to_with_icon, but adds the active class if the current page matches the URL.
link_to_edit
Renders an edit button for a resource. Only renders if the user has update permission.
| Option | Type | Default | Description |
|---|---|---|---|
url | String | auto | Custom URL (defaults to edit_object_url(resource)) |
class | String | btn btn-light btn-sm | CSS classes |
data | Hash | {action: 'edit'} | Data attributes |
link_to_delete
Renders a delete button with confirmation. Only renders if the user has destroy permission.
| Option | Type | Default | Description |
|---|---|---|---|
url | String | auto | Custom URL (defaults to object_url(resource)) |
name | String | βDeleteβ | Button text |
icon | String | trash | Custom icon |
no_text | Boolean | false | Show only icon |
class | String | btn btn-danger btn-sm | CSS classes |
data | Hash | confirm + method | Data attributes |
button
Renders a submit button with optional icon and loading state.
| Parameter | Type | Default | Description |
|---|---|---|---|
text | String | required | Button text |
icon_name | String | nil | Optional icon |
button_type | String | submit | Button type |
class | String | btn-primary | CSS classes |
external_link_to
Renders an external link that opens in a new tab with an indicator icon.
| Parameter | Type | Description |
|---|---|---|
label | String | Link text |
url | String | External URL |
target | Symbol | Default: :blank |
rel | Symbol | Default: :nofollow |
external_page_preview_link
Renders a link to preview a resource on the storefront.
page_header_back_button
Renders a back button for page headers with smart return URL handling.
| Parameter | Type | Description |
|---|---|---|
default_url | String | Default URL to navigate back to |
object | Object | Optional object to check for stored return URL in session |
label | String | Optional label text |
per_page_dropdown
Renders a dropdown for selecting items per page on index pages.
link_to_export_modal
Renders a button to open the export modal. Only renders if user can create exports.
Store Helpers
Helpers for store-specific options and unit systems.weight_units
Returns weight unit options based on the storeβs unit system.
- Metric:
[["Kilogram", "kg"], ["Gram", "g"]] - Imperial:
[["Pound", "lb"], ["Ounce", "oz"]]
| Parameter | Type | Default | Description |
|---|---|---|---|
store | Spree::Store | current_store | Store to check unit system |
dimension_units
Returns dimension unit options based on the storeβs unit system.
- Metric:
[["Centimeter", "cm"], ["Millimeter", "mm"]] - Imperial:
[["Inch", "in"], ["Foot", "ft"]]
| Parameter | Type | Default | Description |
|---|---|---|---|
store | Spree::Store | current_store | Store to check unit system |
unit_systems
Returns available unit system options.
[["Metric System", "metric"], ["Imperial System", "imperial"]]
display_on_options
Returns display location options for calculators and payment/shipping methods.
[["Both", "both"], ["Backend", "back_end"], ["Frontend", "front_end"]]
Turbo Helpers
Helpers for Turbo Streams and Turbo-enhanced forms.turbo_close_dialog
Returns a Turbo Stream response that closes the main dialog.
turbo_render_alerts
Returns a Turbo Stream response that updates the alerts frame.
| Parameter | Type | Default | Description |
|---|---|---|---|
frame_name | Symbol | :alerts | Turbo frame to update |
turbo_save_button_tag
Creates a save button with loading state for Turbo forms.
- Shows spinner during submission
- Integrates with
turbo-submit-buttonStimulus controller - Prevents double submissions
| Parameter | Type | Default | Description |
|---|---|---|---|
label | String | βSaveβ | Button label |
class | String | btn btn-primary text-center | CSS classes |
Context Helpers
current_store
Returns the current store instance.
current_currency
Returns the currently selected currency for the admin session.
current_vendor
Available only in Spree Enterprise Edition.
supported_currencies
Returns the list of supported currencies for the current store.
try_spree_current_user
Returns the current user object or nil if not signed in.
available_countries_iso
Returns ISO codes for countries available for checkout in the current store.
Utility Helpers
flag_emoji
Returns the flag emoji for a country ISO code.
required_span_tag
Renders a red asterisk indicator for required fields.
<span class="required font-weight-bold text-danger"> *</span>
error_message_on
Renders validation error messages for a form field.
<span class="formError">can't be blank</span>
settings_area?
Returns true if the current page is in the settings area.
enterprise_edition?
Returns true if Spree Enterprise Edition is installed.
allowed_file_types_for_upload
Returns allowed file types for Active Storage uploads.
render_admin_partials
Renders all registered partials for an injection point.
Preference Helpers
Helpers for rendering preference fields in settings forms.preference_fields
Renders all preference fields for an object.
preference_field
Renders a single preference field.
preference_field_for
Renders a form field based on preference type.
| Type | Rendered Field |
|---|---|
:integer | Number field |
:decimal | Number field with step |
:boolean | Checkbox |
:string | Text field |
:password | Password field |
:text | Text area |

