Form Select
The Select component is a user-friendly form control designed to let users pick an option or multiple options from a set. Upon selection, it presents a dialog showcasing all choices in an easily navigable list, with features like added context messages, error indications, and a disabled mode.
Variants
Default
The Default variation of the Select component is a simple HTML form element.
Select with Message
The Select component can be used with a message to provide additional context.
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.
Error State
The Select component can indicate an error state.
Disabled
The Select component can be marked as disabled. Selects labeled as Disabled will not be submitted in forms.
Sage Component
SageFormSelect
<h2>Variants</h2>
<h3>Default</h3>
<p>The Default variation of the Select component is a simple HTML form element.</p>
<%= sage_component SageFormSelect, {
name: "Language",
id: "language",
select_options: [
{
text: "de - German",
value: "de",
},
{
text: "en - English",
value: "en",
},
{
text: "es - Spanish",
value: "es",
},
{
text: "fi - Finnish",
value: "fi",
},
{
text: "fr - French",
value: "fr",
},
],
} %>
<%= sage_component SageDivider, {} %>
<h3>Select with Message</h3>
<p>The Select component can be used with a message to provide additional context.</p>
<%= sage_component SageFormSelect, {
name: "Default Currency",
select_options: [
{
text: "USD - United States Dollar",
value: "USD",
},
{
text: "AED - United Arab Emirates Dirham",
value: "AED",
},
{
text: "AFN - Afghan Afghani",
value: "AFN",
},
{
text: "ALL - Albanian Lek",
value: "ALL",
},
],
message: "The default currency will be used for formatting and calculation purposes."
} %>
<%= sage_component SageDivider, {} %>
<h3>Select with Message and Help Content</h3>
<p>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.</p>
<% 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, {} %>
<h3>Error State</h3>
<p>The Select component can indicate an error state.</p>
<%= sage_component SageFormSelect, {
name: "Text direction",
has_error: true,
select_options: [
{
text: "Left to right (ltr)",
value: "ltr",
},
{
text: "Right to left (rtl)",
value: "rtl",
},
],
message: "This field is required."
} %>
<%= sage_component SageDivider, {} %>
<h3>Disabled</h3>
<p>The Select component can be marked as disabled. Selects labeled as Disabled will not be submitted in forms.</p>
<%= sage_component SageFormSelect, {
name: "Text direction",
disabled: true,
select_options: [
{
text: "Left to right (ltr)",
value: "ltr",
},
{
text: "Right to left (rtl)",
value: "rtl",
},
],
message: "This field is not available until you select a language."
} %>
Property | Description | Type | Default |
---|---|---|---|
|
Enabling this property adds the |
Boolean |
|
|
Enabling this property styles the select in the default danger color theme. |
Boolean |
|
|
Sets the content for the "help content" area adjacent to the select's label |
String |
|
|
Displays the message text for the component. |
String |
|
|
Unique identifier for this component. |
String |
|
|
An array of items that will serve as the |
|
|
- Use the
sage-btn-group
for more than one button to apply spacing - If the context does not already provide positioning settings (such as inside a card or panel footer)
use the
sage-btn-group--align-end
to place buttons on the right side of a space.