Sections
Icons
Stacks provides a complete icon set, managed separately in the Stacks-Icons repository. There you’ll find deeper documentation on the various uses as well as the icons’ source in our design tool Figma.
Usage
Section titled UsageStacks icons are designed to be directly injected into the markup as an svg
element. This allows us to color them on the fly using any of our atomic classes. We have different helpers in different environments.
Production
Section titled ProductionIf you’re in Stack Overflow’s production environment, we have a helper that can be called with @Svg.
and the icon name, eg. @Svg.Alert
. By default, any icon will inherit the text color of the parent element. Optionally, you can pass the class native
to the icon to render any native colors that are included eg. @Svg.Ballon.With("native")
. This same syntax allows you to pass additional arbitrary classes like atomic helpers, or js-
prefixed classes.
@Svg.Logo
@Svg.Logo.With("native")
@Svg.Logo.With("fc-black-350 float-right js-dropdown-target")
Prototypes
Section titled PrototypesOur icon set also includes a JavaScript library for use in protoypes outside our production environment. This JavaScript is loaded in our Stacks playground in Codepen. If you’re building a prototype in your own environment, you’ll need to include Stacks as a dependency as well as the icons library.
<svg data-icon="Logo"></svg>
<svg data-icon="Logo" class="native"></svg>
<svg data-icon="Logo" class="fc-black-350 float-right js-dropdown-target"></svg>
Documentation
Section titled DocumentationFor use within our documentation, we’ve also included a Liquid helper.
{% icon "Logo" %}
{% icon "Logo", "native" %}
{% icon "Logo", "fc-black-350 float-right js-dropdown-target" %}
Requesting an icon
Section titled Requesting an iconIf an icon you need isn’t here, please do one of the following two options:
- Submit a request outlining the desired icon, the icon’s intended purposed, and where it will be used.
- If the icon is ready, submit a pull request to have it to be reviewed. Please be sure to provide the same information as above.