Skip to content

Counter

Table of contents
Table of contents

Use Primer::CounterComponent to add a count to navigational elements and buttons.

Examples

Default

<%= render(Primer::CounterComponent.new(count: 25)) %>

Arguments

NameTypeDefaultDescription
countInteger, Float::INFINITY, nil0The number to be displayed (e.x. # of issues, pull requests)
schemeSymbol:defaultColor scheme. One of SCHEME_MAPPINGS.keys.
limitInteger, nil5_000Maximum value to display. Pass nil for no limit. (e.x. if count == 6,000 and limit == 5000, counter will display "5,000+")
hide_if_zeroBooleanfalseIf true, a hidden attribute is added to the counter if count is zero.
textString""Text to display instead of count.
roundBooleanfalseWhether to apply our standard rounding logic to value.
system_argumentsHashN/ASystem arguments