Choice
A radio button tab for making a choice. To be used inside a tabs component.
Single Line with Active State (radio type)
With Radio
Multi-Line (radio type)
Arrow Variation
Icon Variation
Select any icon to appear to the left of the text.
With additional subtext.
Graphic Variation (with link text)
Provide a graphic to the left of the text.
Rich text/Customized
Choice cards can also be opened up for custom content to be composed within.
Custom heading
Custom content here...
Icon alignment
While by default all icon types will align in the center of the choice card, they can be adjusted to align at the "start" or top of the card.
Sage Component
SageChoice
<%
long_description = "Description with longer text to cause wrapping and make the top alignment appear more necessary."
%>
<h3 class="t-sage-heading-6">Single Line with Active State (radio type)</h3>
<%= sage_component SageChoice, {
target: "example",
text: "Option 1",
type: "radio",
active: true,
} %>
<h3 class="t-sage-heading-6">With Radio</h3>
<%= sage_component SageChoice, {
target: "example",
text: "Option 1a",
type: "radio",
active: false,
radio_configs: {
id: 'cr-1a',
name: 'cr-1',
value: 'option-a',
}
}
%>
<h3 class="t-sage-heading-6">Multi-Line (radio type)</h3>
<%= sage_component SageChoice, {
target: "example",
text: "Option 1",
subtext: "Description of Option 1",
type: "radio",
}
%>
<h3 class="t-sage-heading-6">Arrow Variation</h3>
<%= sage_component SageChoice, {
attributes: {
href: "//example.com"
},
text: "Option 1",
type: "arrow",
}
%>
<h3 class="t-sage-heading-6">Icon Variation</h3>
<p>Select any icon to appear to the left of the text.</p>
<%= sage_component SageChoice, {
target: "example",
text: "Option 1",
type: "icon",
icon: "video-on",
}
%>
<p>With additional subtext.</p>
<%= sage_component SageChoice, {
target: "example",
text: "Option 1",
type: "icon",
icon: "video-on",
subtext: "Description of Option 1",
}
%>
<h3 class="t-sage-heading-6">Graphic Variation (with link text)</h3>
<p>Provide a graphic to the left of the text.</p>
<%= sage_component SageChoice, {
target: "example",
text: "Calendly",
type: "graphic",
graphic: image_tag("card-placeholder-sm.png", alt: ""),
link_text: "Sign in",
attributes: {
href: "http://example.com",
},
}
%>
<h3 class="t-sage-heading-6">Rich text/Customized</h3>
<p>Choice cards can also be opened up for custom content to be composed within.</p>
<style>
.custom-choice {
max-width: 352px;
}
.custom-choice__content {
text-align: center;
justify-items: center;
}
</style>
<%= sage_component SageChoice, {
attributes: {
href: "http://example.com",
},
css_classes: "custom-choice",
custom_content_class: "custom-choice__content",
target: "example",
} do %>
<%= sage_component SageAvatar, { initials: 'PS' } %>
<%= sage_component SageCardBlock, {} do %>
<h4>Custom heading</h4>
<p>Custom content here...</p>
<% end %>
<% end %>
<h3 class="t-sage-heading-6">Icon alignment</h3>
<p>While by default all icon types will align in the center of the choice card, they can be adjusted to align at the "start" or top of the card.</p>
<%= sage_component SageChoice, {
target: "example",
text: "Option 1",
subtext: long_description,
type: "radio",
vertical_align_icon: "start",
}
%>
<%= sage_component SageChoice, {
target: "example",
text: "Option 1",
subtext: long_description,
type: "icon",
icon: "video-on",
vertical_align_icon: "start",
}
%>
Property | Description | Type | Default |
---|---|---|---|
|
Toggles |
Boolean |
|
|
Toggles |
Boolean |
|
|
Configures how the icons ("radio" and "icon"; not "arrow" or "graphc") should be vertically aligned within the card. |
|
|
|
For setting additional attributes not defined above. Accepts a Ruby hash of valid key-value properties, such as data-attributes |
Hash |
|
|
Sets the state to \"disabled\" by default. |
Boolean |
|
|
Sets a custom class on the |
String |
|
|
Sets the image path to for asset for this component. |
String |
|
|
Provides the name of the Sage Icon to be displayed before the text content. |
String |
|
|
Sets the link text for the component. |
String |
|
|
If provided, this adjusts a choice to include a radio |
{ name: String, id: String, value: String } |
|
|
Sets the content of the secondary text line |
String |
|
|
Provides the |
String |
|
|
Sets the content of the primary text line |
String |
|
|
Sets the choice graphic type. If |
|
|
- The
radio
type should only be used to conditionally render content. This component should not be used as a form field. In that case use the Radio component