<h2>Variants</h2>
<h3>Primary</h3>
<p>Default button styles, used with affirmative actions such as submitting, continuing, and saving.</p>
<%= sage_component SageButtonGroup, { gap: :sm, spacer: { bottom: :sm }} do %>
<%= sage_component SageButton, {
value: "Button",
style: "primary",
} %>
<%= sage_component SageButton, {
value: "Disabled",
style: "primary",
attributes: {
type: "submit"
},
disabled: true,
} %>
<%= sage_component SageButton, {
value: "Right icon",
style: "primary",
icon: {
style: "right",
name: "menu"
}
} %>
<%= sage_component SageButton, {
value: "Left icon",
style: "primary",
icon: {
style: "left",
name: "menu"
}
} %>
<%= sage_component SageButton, {
value: "Icon button",
style: "primary",
icon: {
style: "only",
name: "menu"
}
} %>
<% end %>
<%= sage_component SageDivider, {} %>
<h3>Accent</h3>
<p>Accent button styles, used for tertiary actions or when more contrast is needed.</p>
<%= sage_component SageButtonGroup, { gap: :sm, spacer: { bottom: :sm }} do %>
<%= sage_component SageButton, {
value: "Button",
style: "accent",
} %>
<%= sage_component SageButton, {
value: "Disabled",
style: "accent",
disabled: true,
attributes: {
type: "submit"
}
} %>
<%= sage_component SageButton, {
value: "Left icon",
style: "accent",
icon: {
style: "left",
name: "menu"
}
} %>
<%= sage_component SageButton, {
value: "Left icon",
style: "accent",
icon: {
style: "left",
name: "menu"
}
} %>
<%= sage_component SageButton, {
value: "Icon button",
style: "accent",
icon: {
style: "only",
name: "menu"
}
} %>
<% end %>
<%= sage_component SageDivider, {} %>
<h3>Danger / Destructive</h3>
<p>Danger or destructive button styles, used with actions that delete information such as deleting an item or removing a contact.</p>
<%= sage_component SageButtonGroup, { gap: :sm, spacer: { bottom: :sm }} do %>
<%= sage_component SageButton, {
value: "Button",
style: "danger",
} %>
<%= sage_component SageButton, {
value: "Disabled",
style: "danger",
disabled: true,
attributes: {
type: "submit"
}
} %>
<%= sage_component SageButton, {
value: "Left icon",
style: "danger",
icon: {
style: "left",
name: "menu"
}
} %>
<%= sage_component SageButton, {
value: "Left icon",
style: "danger",
icon: {
style: "left",
name: "menu"
}
} %>
<%= sage_component SageButton, {
value: "Icon button",
style: "danger",
icon: {
style: "only",
name: "menu"
}
} %>
<% end %>
<%= sage_component SageDivider, {} %>
<h3>Secondary</h3>
<p>Secondary button styles, used with neutral actions such as going back, saving as a draft, and canceling.</p>
<%= sage_component SageButtonGroup, { gap: :sm, spacer: { bottom: :sm }} do %>
<%= sage_component SageButton, {
value: "Button",
style: "secondary",
} %>
<%= sage_component SageButton, {
value: "Disabled",
style: "secondary",
disabled: true,
attributes: {
type: "submit"
}
} %>
<%= sage_component SageButton, {
value: "Right icon",
style: "secondary",
icon: {
style: "right",
name: "menu"
}
} %>
<%= sage_component SageButton, {
value: "Left icon",
style: "secondary",
icon: {
style: "left",
name: "menu"
}
} %>
<%= sage_component SageButton, {
value: "Icon button",
style: "secondary",
icon: {
style: "only",
name: "menu"
}
} %>
<% end %>
<%= sage_component SageDivider, {} %>
<h3>Subtle</h3>
<p>
<%= sage_component SageBadge, {
color: "danger",
value: "Deprecated",
}%>
<%= md('Subtle buttons are deprecated. Replace Subtle button with a “plain” link. See documentation for the <a href="link">Link</a> component.') %>
</p>
<%= sage_component SageButtonGroup, { gap: :sm, spacer: { bottom: :sm }} do %>
<%= sage_component SageButton, {
value: "Button",
style: "primary",
subtle: true,
} %>
<%= sage_component SageButton, {
value: "Disabled",
style: "primary",
disabled: true,
subtle: true,
attributes: {
type: "submit"
}
} %>
<%= sage_component SageButton, {
value: "Right icon",
style: "primary",
subtle: true,
icon: {
style: "right",
name: "menu"
}
} %>
<%= sage_component SageButton, {
value: "Left icon",
style: "primary",
subtle: true,
icon: {
style: "left",
name: "menu"
}
} %>
<%= sage_component SageButton, {
value: "Icon button",
style: "primary",
subtle: true,
icon: {
style: "only",
name: "menu"
}
} %>
<% end %>
<%= sage_component SageDivider, {} %>
<h3>Disclosure Button</h3>
<p>The disclosure button is used with menus and dropdown components. </p>
<%= sage_component SageButtonGroup, { gap: :sm, spacer: { bottom: :sm }} do %>
<%= sage_component SageButton, {
value: "Month",
disclosure: true,
attributes: {
href: "#",
rel: "noopener",
title: "Select month"
},
style: "secondary",
} %>
<%= sage_component SageButton, {
value: "Add item",
disclosure: true,
icon: { name: "add", style: "left" },
attributes: {
href: "#",
rel: "noopener",
title: "Add an item"
},
style: "secondary",
} %>
<%= sage_component SageButton, {
css_classes: "sage-btn--rich-text",
value: "Add item",
icon: { name: "add", style: "only" },
attributes: {
href: "#",
rel: "noopener",
title: "Open Sassdocs site"
},
style: "secondary",
} %>
<% end %>
<%= sage_component SageDivider, {} %>
<h3>Loading State</h3>
<p>Displays a loading indicator in the button, such as when a button is used to submit a form. Including the <code>spinner_on_submit</code> property will activate the loading state, and place the corresponding text as the <code>aria-label</code>.</p>
<%= sage_component SageButton, {
value: "Select to activate loading state",
spinner_on_submit: "my aria label",
attributes: {
href: "#",
rel: "noopener",
title: "Activate loading state"
},
style: "primary",
} %>
<%= sage_component SageDivider, {} %>
<h3>Small Button</h3>
<p>
<%= sage_component SageBadge, {
color: "danger",
value: "Deprecated",
}%>
<%= md('With the Subtle button being deprecated, this property will be as well. Replace Subtle button with a “plain” link. See documentation for the <a href="link">Link</a> component.') %>
</p>
<%= sage_component SageButton, {
value: "Small button here",
style: "primary",
subtle: true,
small: true
} %>
<%= sage_component SageDivider, {} %>
<h3>Full Width</h3>
<p>Displays a button that takes up 100% of the width of its container. Enable the <code>full_width</code> treatment by adding the attribute: <code>full_width: true</code>.</p>
<div>
<%= sage_component SageButton, {
value: "Full width button example",
style: "primary",
full_width: true
} %>
</div>
<%= sage_component SageDivider, {} %>
<h2>Button Groups</h2>
<%= sage_component SageDivider, {} %>
<h3>Aligned to the end</h3>
<%= sage_component SageButtonGroup, { gap: :sm, align: "end" } do %>
<%= sage_component SageButton, {
value: "Button",
style: "secondary",
} %>
<%= sage_component SageButton, {
value: "Button",
style: "primary",
} %>
<% end %>
<%= sage_component SageDivider, {} %>
<h3>Space Between</h3>
<%= sage_component SageButtonGroup, { gap: :sm, align: "space-between" } do %>
<%= sage_component SageButton, {
value: "Button",
style: "secondary",
} %>
<%= sage_component SageButton, {
value: "Button",
style: "primary",
} %>
<% end %>
<%= sage_component SageDivider, {} %>
<h3>Left inline</h3>
<%= sage_component SageButtonGroup, { gap: :sm } do %>
<%= sage_component SageButton, {
value: "Button",
style: "primary",
} %>
<%= sage_component SageLink, {
url: "#",
label: "Link",
external: false,
launch: false,
help_link: false,
remove_underline: true,
show_label: true,
style: "secondary"
} %>
<% end %>
<%= sage_component SageDivider, {} %>
<h3>Nested button group</h3>
<%= sage_component SageButtonGroup, { gap: :sm, align: "space-between" } do %>
<%= sage_component SageLink, {
url: "#",
label: "Link",
external: false,
launch: false,
help_link: false,
remove_underline: true,
show_label: true,
style: "secondary"
} %>
<%= sage_component SageButtonGroup, { gap: :sm } do %>
<%= sage_component SageButton, {
value: "Button",
style: "secondary",
} %>
<%= sage_component SageButton, {
value: "Button",
style: "primary",
} %>
<% end %>
<% end %>
<%= sage_component SageDivider, {} %>
<h3>Aligned to the end and border top</h3>
<%= sage_component SageButtonGroup, { gap: :sm, align: "end", borderTop: true } do %>
<%= sage_component SageButton, {
value: "Button",
style: "secondary",
} %>
<%= sage_component SageButton, {
value: "Button",
style: "primary",
} %>
<% end %>
<%= sage_component SageDivider, {} %>
<h3>Button Group Wrap</h3>
<p>When enabled, button groups are no longer restricted to a single row, allowing contents to wrap to multiple lines via <code>flex-wrap: wrap</code>.</p>
<p>Note: all button groups regardless of this attribute will wrap at breakpoints below <code>sm-min</code> to prevent horizontal scrolling on small screen devices.</p>
<p>Click the button below to toggle button group wrapping throughout the page, and resize your browser to view the resulting change.</p>
<%= sage_component SageButton, {
value: "Toggle button group wrap",
style: "primary",
icon: {
style: "right",
name: "menu-bordered"
},
attributes: {
id: "button-group-wrap-example"
}
} %>