Badge
Variants
Default Badge
Demonstrates the use of the default badge with various color options.
Dot
Demostrates a badge with an indicator dot.
Interactive Badge
Demonstrates an interactive badge with dropdown functionality.
Large Badge
Demonstrates larger badge sizes for emphasis.
Sage Component
SageBadge
<h2>Variants</h2>
<h3>Default Badge</h3>
<p>Demonstrates the use of the default badge with various color options.</p>
<%= sage_component SageLabelGroup, { gap: :md, spacer: { bottom: :sm }} do %>
<%= sage_component SageBadge, { color: "draft", value: "Neutral" } %>
<%= sage_component SageBadge, { color: "info", value: "Info" } %>
<%= sage_component SageBadge, { color: "published", value: "Success" } %>
<%= sage_component SageBadge, { color: "warning", value: "Warning" } %>
<%= sage_component SageBadge, { color: "danger", value: "Danger" } %>
<%= sage_component SageBadge, { color: "locked", value: "Accent" } %>
<% end %>
<%= sage_component SageDivider, {} %>
<h3>Dot</h3>
<p>Demostrates a badge with an indicator dot.</p>
<%= sage_component SageLabelGroup, { gap: :md, spacer: { bottom: :sm }} do %>
<%= sage_component SageBadge, { color: "draft", value: "Neutral" } do %>
<% content_for :sage_badge_dot do %>
<%= sage_component SageDot, { color: "primary" } %>
<% end %>
<% end %>
<%= sage_component SageBadge, { color: "info", value: "Info" } do %>
<% content_for :sage_badge_dot do %>
<%= sage_component SageDot, { color: "primary" } %>
<% end %>
<% end %>
<%= sage_component SageBadge, { color: "published", value: "Success" } do %>
<% content_for :sage_badge_dot do %>
<%= sage_component SageDot, { color: "primary" } %>
<% end %>
<% end %>
<%= sage_component SageBadge, { color: "warning", value: "Warning" } do %>
<% content_for :sage_badge_dot do %>
<%= sage_component SageDot, { color: "primary" } %>
<% end %>
<% end %>
<%= sage_component SageBadge, { color: "danger", value: "Danger" } do %>
<% content_for :sage_badge_dot do %>
<%= sage_component SageDot, { color: "primary" } %>
<% end %>
<% end %>
<%= sage_component SageBadge, { color: "locked", value: "Accent" } do %>
<% content_for :sage_badge_dot do %>
<%= sage_component SageDot, { color: "primary" } %>
<% end %>
<% end %>
<% end %>
<%= sage_component SageDivider, {} %>
<h3>Interactive Badge</h3>
<p>Demonstrates an interactive badge with dropdown functionality.</p>
<%= sage_component SageLabelGroup, { gap: :md, spacer: { bottom: :sm }} do %>
<%= sage_component SageBadge, { color: "draft", value: "Neutral", interactive_type: :dropdown } %>
<%= sage_component SageBadge, { color: "info", value: "Info", interactive_type: :dropdown } %>
<%= sage_component SageBadge, { color: "published", value: "Success", interactive_type: :dropdown } %>
<%= sage_component SageBadge, { color: "warning", value: "Warning", interactive_type: :dropdown } %>
<%= sage_component SageBadge, { color: "danger", value: "Danger", interactive_type: :dropdown } %>
<%= sage_component SageBadge, { color: "locked", value: "Accent", interactive_type: :dropdown } %>
<% end %>
<%= sage_component SageDivider, {} %>
<h3>Large Badge</h3>
<p>Demonstrates larger badge sizes for emphasis.</p>
<%= sage_component SageLabelGroup, { gap: :md, spacer: { bottom: :sm }} do %>
<%= sage_component SageBadge, { color: "draft", value: "Neutral", large: true } %>
<%= sage_component SageBadge, { color: "published", value: "Success", large: true } do %>
<% content_for :sage_badge_dot do %>
<%= sage_component SageDot, {} %>
<% end %>
<% end %>
<%= sage_component SageBadge, { color: "warning", value: "Warning", large: true, interactive_type: :dropdown } do %>
<% content_for :sage_badge_dot do %>
<%= sage_component SageDot, {} %>
<% end %>
<% end %>
<% end %>
Property | Description | Type | Default |
---|---|---|---|
|
Sets the color for the badge. |
|
Required |
|
Additional attributes to provide bindings or actions to the badge container. |
Hash |
|
|
Enable to set the badge's element as a |
Boolean |
|
|
Enables rendering of the badge in the "large" format. |
Boolean |
|
|
The text to use as the badge's content |
String |
Required |
Badge Group |
|||
|
Adjusts the alignment of the badges within. |
[ |
|
|
Adjusts the size of the gap between badges. |
[ |
|