diff --git a/docs/app/views/examples/components/form_select/_preview.html.erb b/docs/app/views/examples/components/form_select/_preview.html.erb index 6398663ad2..d1d1165a89 100644 --- a/docs/app/views/examples/components/form_select/_preview.html.erb +++ b/docs/app/views/examples/components/form_select/_preview.html.erb @@ -59,6 +59,46 @@ <%= sage_component SageDivider, {} %> +

Select with Message and Help Content

+

The Select component can display the "Help content" area to provide inline context alongside the label. This area allows text or other components, and may be useful when the Message area is occupied.

+ +<% sample_help_content = sage_component SageLink, { + url: "https://help.kajabi.com", + label: "What are payouts?", + external: true, + launch: true, + help_link: false, + show_label: true, + style: "secondary", + } %> + +<%= sage_component SageFormSelect, { + label: "Payout currency", + name: "payout_currency", + select_options: [ + { + text: "USD - United States Dollar", + value: "USD", + }, + { + text: "CAD - Canadian Dollar", + value: "CAD", + }, + { + text: "AUD - Australian Dollar", + value: "AUD", + }, + { + text: "GBP - British Pound", + value: "GBP", + }, + ], + message: "The payout currency determines the currency used when depositing funds to your bank account", + help_content: sample_help_content, +} %> + +<%= sage_component SageDivider, {} %> +

Error State

The Select component can indicate an error state.

diff --git a/docs/app/views/examples/components/form_select/_props.html.erb b/docs/app/views/examples/components/form_select/_props.html.erb index 04c7d21794..238fd73aed 100644 --- a/docs/app/views/examples/components/form_select/_props.html.erb +++ b/docs/app/views/examples/components/form_select/_props.html.erb @@ -10,6 +10,12 @@ <%= md('Boolean') %> <%= md('`false`') %> + + <%= md('`help_content`') %> + <%= md('Sets the content for the "help content" area adjacent to the select\'s label') %> + <%= md('String') %> + <%= md('`nil`') %> + <%= md('`message`') %> <%= md('Displays the message text for the component.') %> diff --git a/docs/lib/sage_rails/app/sage_components/sage_form_select.rb b/docs/lib/sage_rails/app/sage_components/sage_form_select.rb index a7ebef08bb..f526ecb0dd 100644 --- a/docs/lib/sage_rails/app/sage_components/sage_form_select.rb +++ b/docs/lib/sage_rails/app/sage_components/sage_form_select.rb @@ -2,6 +2,7 @@ class SageFormSelect < SageComponent set_attribute_schema({ disabled: [:optional, NilClass, TrueClass], has_error: [:optional, NilClass, TrueClass], + help_content: [:optional, NilClass, String], id: [:optional, NilClass, String], label: [:optional, NilClass, String], message: [:optional, NilClass, String], diff --git a/docs/lib/sage_rails/app/views/sage_components/_sage_form_select.html.erb b/docs/lib/sage_rails/app/views/sage_components/_sage_form_select.html.erb index ffb87636dc..fd321c5ffc 100644 --- a/docs/lib/sage_rails/app/views/sage_components/_sage_form_select.html.erb +++ b/docs/lib/sage_rails/app/views/sage_components/_sage_form_select.html.erb @@ -7,6 +7,7 @@
+ <%= "sage-select--help-content" if component.help_content %> <%= component.generated_css_classes %>" data-js-select="true" <%= component.generated_html_attributes.html_safe %> @@ -48,6 +49,11 @@ <% end %> + <% if component.help_content.present? %> +
+ <%= component.help_content %> +
+ <% end %>