Skip to content

ButtonGroup

Table of contents
Table of contents

Use ButtonGroup to render a series of buttons.

Examples

Default

<%= render(Primer::ButtonGroup.new) do |component| %>
<% component.button { "Default" } %>
<% component.button(scheme: :primary) { "Primary" } %>
<% component.button(scheme: :danger) { "Danger" } %>
<% component.button(scheme: :outline) { "Outline" } %>
<% component.button(classes: "my-class") { "Custom class" } %>
<% end %>

Variants

<%= render(Primer::ButtonGroup.new(variant: :small)) do |component| %>
<% component.button { "Default" } %>
<% component.button(scheme: :primary) { "Primary" } %>
<% component.button(scheme: :danger) { "Danger" } %>
<% component.button(scheme: :outline) { "Outline" } %>
<% end %>
<%= render(Primer::ButtonGroup.new(variant: :large)) do |component| %>
<% component.button { "Default" } %>
<% component.button(scheme: :primary) { "Primary" } %>
<% component.button(scheme: :danger) { "Danger" } %>
<% component.button(scheme: :outline) { "Outline" } %>
<% end %>

Arguments

NameTypeDefaultDescription
variantSymbolPrimer::ButtonComponent::DEFAULT_VARIANTOne of :small, :medium, or :large.
system_argumentsHashN/ASystem arguments

Slots

Buttons

Required list of buttons to be rendered.

NameTypeDefaultDescription
kwargsHashN/AThe same arguments as Button except for variant and group_item.