Skip to main content

SIDEARM Icons

SIDEARM Sports icon library with over 140+ icons. Include them anyway you like—SVGs, SVG sprite, or web fonts.

npm i @sidearm/sidearm-icons

Currently v0.1.0 Icons Install Usage Styling Accessibility

Social Icons

Install

SIDEARM Icons are published to AWS codeartifact, but they can also be manually downloaded if needed.

npm

Install SIDEARM Icons—including SVGs, icon sprite, and icon fonts—with npm. Then, choose how you’d like to include the icons with the usage instructions.

npm run aws:login
npm i @sidearm/sidearm-icons

CDN

Include the icon fonts stylesheet—in your website <head> or via @import in CSS—from our CDN and get started in seconds. See icon font docs for examples.

<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/sidearm-icons@0.1.0/font/sidearm-icons.css">
@import url("https://cdn.jsdelivr.net/npm/sidearm-icons@0.1.0/font/sidearm-icons.css");

Usage

SIDEARM Icons are SVGs, so you can include them into your HTML in a few ways depending on how your project is setup. We recommend using a width: 1em (and optionally height: 1em) for easy resizing via font-size.

Embedded

Embed your icons within the HTML of your page (as opposed to an external image file). Here we’ve used a custom width and height.

<svg xmlns="http://www.w3.org/2000/svg" width="32" height="32" fill="currentColor" class="s-icon s-icon-social-twitter" viewBox="0 0 16 16">
  <path d="M12.771 5.756a6.957 6.957 0 0 1-6.997 7.323A6.973 6.973 0 0 1 2 11.974a4.942 4.942 0 0 0 3.643-1.02 2.467 2.467 0 0 1-2.3-1.71c.37.07.75.056 1.112-.043A2.463 2.463 0 0 1 2.48 6.788v-.032c.343.191.727.297 1.12.309a2.467 2.467 0 0 1-.765-3.287A6.99 6.99 0 0 0 7.91 6.35a2.467 2.467 0 0 1 4.196-2.246 4.942 4.942 0 0 0 1.562-.598 2.474 2.474 0 0 1-1.081 1.362A4.913 4.913 0 0 0 14 4.48a5 5 0 0 1-1.229 1.276Z"/>
</svg>

Sprite

Use the SVG sprite to insert any icon through the <use> element. Use the icon’s filename as the fragment identifier (e.g., toggles is #toggles). SVG sprites allow you to reference an external file similar to an <img> element, but with the power of currentColor for easy theming.

Heads up! There’s an issue with Chrome where <use> doesn’t work across domains.

<svg class="s-icon s-icon-social-twitter" width="32" height="32" fill="currentColor">
  <use xlink:href="sidearm-icons-social.svg#icon-social-twitter"/>
</svg>
<svg class="s-icon s-icon-social-facebook" width="32" height="32" fill="currentColor">
  <use xlink:href="sidearm-icons-social.svg#icon-social-facebook"/>
</svg>
<svg class="s-icon s-icon-social-instagram" width="32" height="32" fill="currentColor">
  <use xlink:href="sidearm-icons-social.svg#icon-social-instagram"/>
</svg>

External image

Copy the SIDEARM Icons SVGs to your directory of choice and reference them like normal images with the <img> element.

Twitter Icon
<img src="/assets/img/icon-social-twitter.svg" alt="Twitter Icon" width="32" height="32">

Icon font

Icon fonts with classes for every icon are also included for SIDEARM Icons. Include the icon web fonts in your page via CSS, then reference the class names as needed in your HTML (e.g., <span class="sf-social sf-icon-social-twitter"></span>).

Use font-size and color to change the icon appearance.

<span class="sf-social sf-icon-social-twitter"></span>
<span class="sf-social sf-icon-social-twitter" style="font-size: 2rem; color: #1DA1F2;"></span>

Icon Component

Internally you can use the Design system component library to use icons in your project.

<s-icon name="icon-social-twitter"></s-icon>

CSS

You can also use the SVG within your CSS (be sure to escape any characters, such as # to %23 when specifying hex color values). When no dimensions are specified via width and height on the <svg>, the icon will fill the available space.

The viewBox attribute is required if you wish to resize icons with background-size. Note that the xmlns attribute is required.

.s-icon::before {
  display: inline-block;
  content: "";
  vertical-align: -.125em;
  background-image: url("data:image/svg+xml,<svg xmlns='http://www.w3.org/2000/svg' width='32' height='32'  fill='%23333' class='s-icon s-icon-sidearm' viewBox='0 0 16 16'>
  <path d='M8.067 16a.605.605 0 0 1-.467-.2l-2.466-2.533c-.134-.134-.2-.4-.2-.6 0-.2.2-.4.4-.467l5.133-2.4a.709.709 0 0 1 .8.133l1 1.134a.8.8 0 0 1 0 .933L8.6 15.8c-.2.133-.4.2-.533.2Zm-1.4-3L8 14.4l2.734-2.867-.267-.266L6.667 13ZM4.4 11.733a.605.605 0 0 1-.466-.2L.8 8.467C.667 8.333.534 8.2.6 8c.067-.2.067-.333.2-.467l1.934-1.866a.644.644 0 0 1 .933 0l1.467 1.4 6.2-2.8c.266-.134.533-.067.733.133L15.2 7.467c.134.133.2.266.2.466s-.066.334-.2.467l-1.933 1.867a.645.645 0 0 1-.933 0l-1.467-1.4-6.2 2.8c-.133.066-.2.066-.267.066ZM2.2 8l2.334 2.267L10.6 7.6a.605.605 0 0 1 .467-.2c.2 0 .333.067.467.2l1.333 1.267 1-.934-2.333-2.266-6.2 2.733c-.067.067-.2.067-.267.067h-.133a.605.605 0 0 1-.467-.2L3.2 7.067 2.2 8Zm3.134-1.733a.605.605 0 0 1-.467-.2L3.734 4.933a.8.8 0 0 1 0-.933L7.4.2a.72.72 0 0 1 .467-.2c.2 0 .333.067.467.2l2.533 2.533c.133.134.2.4.2.6-.067.2-.2.4-.4.467L5.6 6.2c-.133.067-.2.067-.266.067Zm-.2-1.8.333.333L9.334 3l-1.4-1.4-2.8 2.867Z'/>
</svg>");
  background-repeat: no-repeat;
  background-size: 1rem 1rem;
}

Styling

Color can be changed by setting a .text-* class or custom CSS:

<svg class="s-icon s-icon-social-twitter text-success" width="32" height="32" fill="currentColor" viewBox="0 0 16 16" xmlns="http://www.w3.org/2000/svg">
  ...
</svg>

Accessibility

For purely decorative icons, add aria-hidden="true". Otherwise, provide an appropriate text alternative. Depending on which method you’re using to add the icons, and where you’re using them (e.g. as standalone images, or as the only content of a button or similar control), there are various possible approaches. Here are a few examples:

Twitter Logo
<!-- alt="..." on <img> element -->
<img src="/assets/img/icon-social-twitter.svg" alt="Twitter Logo" ...>
<span class="sf-social sf-icon-social-twitter" role="img" aria-label="Twitter Logo"></span>
<svg class="s-icon" ... role="img" aria-label="Twitter Logo">
  <use xlink:href="sidearm-icons-social.svg#icon-social-twitter"/>
</svg>
<!-- aria-label="..." on the control -->
<button ... aria-label="Mute">
  <svg class="s-icon s-icon-social-twitter" aria-hidden="true" ...>
  ...
  </svg>
</button>

Working with SVGs

SVGs are awesome to work with, but they do have some known quirks to work around. Given the numerous ways in which SVGs can be used, we haven’t included these attributes and workarounds in our code.

Known issues include:

  • SVGs receive focus by default in Internet Explorer and Edge Legacy. When embedding your SVGs, add focusable="false" to the <svg> element. Learn more on Stack Overflow.

  • When using SVGs with <img> elements, screen readers may not announce them as images, or skip the image completely. Include an additional role="img" on the <img> element to avoid any issues. See this article for details.

  • External SVG sprites may not function correctly in Internet Explorer. Use the svg4everybody polyfill as needed.

Found another issue with SVGs we should note? Please open an issue to share details.