Skip to content

Bulls

Bulls is a component that displays different types of status indicators as SVG icons. It’s useful for showing success, failure, pending, warning, or informational states in your application.

See the Example by Serhii Pimenov on CodePen.

<div data-role="bull" data-type="success" data-size="24"></div>
ParameterTypeDefaultDescription
typestring”success”Type of bull icon. Possible values: “success”, “fail”, “pending”, “warning”, “bulb”, “default”
sizenumber16Size of the bull icon in pixels
onBullCreatefunctionMetro.noopCallback function triggered when the bull is created
onBullChangefunctionMetro.noopCallback function triggered when the bull type is changed
  • setType(type): Changes the type of the bull component.
  • changeAttribute(attr, value): Changes the attribute of the bull component.
  • destroy(): Removes the bull element from the DOM.
<div id="myBull" data-role="bull" data-type="fail" data-size="32"></div>
const bull = Metro.getPlugin('#myBull', 'bull');
bull.setType('warning'); // Change the bull type to warning

You can set up global configuration for all bull components using:

Metro.bullSetup({
size: 32
});
  • success: Indicates a successful operation.
  • fail: Indicates a failed operation.
  • pending: Indicates an operation that is still in progress (animated).
  • warning: Indicates a warning or caution.
  • bulb-on: Represents an active informational state.
  • bulb-off: Represents an inactive informational state.
  • star: Represents a star icon, often used for favorites or highlights.
  • badge: Represents a badge icon, often used for notifications or counts.
  • chat: Represents a chat icon, often used for messaging or communication.
  • tree: Represents a tree icon, often used for hierarchical data or navigation.
  • checkmark: Represents a checkmark icon, often used for confirmations or selections.
  • cancel: Represents a cancel icon, often used for dismissing or closing actions.
  • rocket: Represents a rocket icon, often used for launching or starting actions.
<div data-role="bull" data-type="success" data-size="32"></div>
<div data-role="bull" data-type="success" data-size="24" style="fill: #57ab5a;"></div>

or

<div data-role="bull" data-type="success" data-size="24" class="fc-red"></div>
EventDescription
bull-createTriggered when the bull component is created
bull-changeTriggered when the bull type is changed

The Bulls component uses SVG with inline styling, so there are no specific CSS variables to customize. The colors are defined within the SVG paths:

  • Success: Green (#57ab5a)
  • Fail: Red (#e5534b)
  • Pending: Yellow (#DBAB0A)
  • Warning: Orange (#ff4d00)
  • Bulb: Yellow (#ffde21)