Skip to content

Icons

Readme Changelog

Development stage

1
In research
2
Alpha
3
Beta
4
Production

Alpha components have not been thoroughly tested by developers. Learn more about component maturity.

Icons are visual cues that help people find key information and common actions. They visually represent:

  • An idea or thing
  • What something does
  • How someone can interact with it

Icons reduce cognitive load by communicating meanings or actions simply and accurately.

When and how to use it

Use icons as visual indicators to make key actions or information easy to find. Organize content strategically before using icons. Choose an existing icon from Version 5.6.2 of the CAGov icon library whenever possible.

Use icons for the same purpose consistently to avoid confusion for visitors and reduce cognitive load. Select an icon that’s as closely tied to the specific information or action as possible. When it may not be clear what the icon means, pair it with a label or supporting text.

The Design System uses a standard set of icons for common actions. Several components incorporate icons automatically. This ensures consistency, and fewer steps for content designers. Some examples include:

For a page alert, choose an icon that supports the tone of the alert.

How not to use it

Do not use an icon:

  • That does not relate to the meaning or action
  • Without a label if it is not widely understood
  • For more than one function or concept
  • Where an image or graphic is more appropriate
  • For decoration
  • If it creates visual clutter (like using too many on a page)
  • As a shortcut to guide visitors to important information without structuring content strategically

Specs

PropertyValue
Machine nameds-icons
JavaScriptyes

Project installation

Method 1

Minimal sprite and JavaScript

Recommended for projects that use 10 - 200 icons.

The instructions assume familiarity with npm package management tool, modern JavaScript techniques, and Sass.

  1. Identify all the icons you will need for your project by id using the Icon library below.

  2. npm install @cagov/ds-icons

  3. Run the command npm run dev:sprite-some [ids] to generate a the sprite

    • Example: npm run dev:sprite-some gear arrow-down left
  4. The generated sprite will be called cagovSomeIcons.svg.

  5. Include the generated sprite and ./index.js as a module in your project or page.

  6. Place individual icon inline with <cagov-icon data-icon="[id]"></cagov-icon>

Demo and sample markup

HTML

<div
  style="display:grid; grid-template-columns: 1fr 1fr; grid-gap: 20px; text-align: center;"
>
  <!--Decorative-->
  <cagov-icon data-icon="arrow-down"></cagov-icon>
  <cagov-icon data-icon="drive"></cagov-icon>
  <!--Functional-->
  <cagov-icon data-icon="gear" data-sr="Settings"></cagov-icon>
  <cagov-icon data-icon="left" data-sr="Next Page"></cagov-icon>
</div>

Method 2

Direct download and include.

Recommended for projects that use 1-9 icons.

  1. Identify the icon(s) you will need for your project by id using the Icon library below.

  2. Click the Download link.

  3. Copy/paste or reference the icon in your project.

Method 3

Icon font and CSS.

Recommended for projects where content authors need to be able to add any font inline using only HTML.

  1. Copy the src/fonts folder to your web app.

  2. Copy the src/icon-font.css file to your web app.

  3. Include the CSS in your project or page. The CSS must be at the same directory level as the fonts folder.

  4. Place individual icon in HTML using <span class="ca-gov-icon-[id]" aria-hidden="true"></span>

Demo and sample markup

HTML

<span class="ca-gov-icon-audio" aria-hidden="true"></span>
<span class="ca-gov-icon-drive" aria-hidden="true"></span>
<span class="ca-gov-icon-ferry" aria-hidden="true"></span>
<span class="ca-gov-icon-van" aria-hidden="true"></span>

Accessibility recommendations

Component-specific accessibility review

These icons are decorative by default and use the aria-hidden attribute. Associated text can be made available to screen readers using Method 1 and the attribute pattern data-sr="My descriptive text." When using Methods 2 and 3, be mindful of accessibility best practices.

Standard accessibility review

As a component in Alpha status, this component must pass the following accessibility reviews every time a new version is published:

  • Tested with the axe accessibility tool and passes all automated WCAG Level AA checks
  • Reviewed with the VoiceOver screen reader on desktop
  • Verified keyboard navigation and that all actionable elements of the component are reachable via keyboard commands only
  • Reviewed component layout on a variety of screen sizes

Contributor/developer documentation

Icon library

Version 5.6.2 of the CAGov icon library. Download individual svgs using the links below.

albumsamexcardamusementanchorandroidangryapple-payappleappsarchivearrow-downarrow-fill-downarrow-fill-left-downarrow-fill-left-uparrow-fill-leftarrow-fill-right-downarrow-fill-right-uparrow-fill-rightarrow-fill-uparrow-leftarrow-nextarrow-prevarrow-rightarrow-upat-signattachmentaudiobambintonbaloonsbar-chartbarge-shipbars-upbars-upwardbaseballlbasketballbathbearbellbikebilliardsbinocularsbiohazardboatbookbookmarkbooksbowlingbrainbridge-altbridgebriefcasebuildingbus-altbusca-capitolca-statecal-bearcalcalculatorcalendarcallcameracampfirecannabiscapitolcar-altcarcare-tweezerscaret-downcaret-fill-downcaret-fill-leftcaret-fill-rightcaret-fill-two-downcaret-fill-two-leftcaret-fill-two-rightcaret-fill-two-upcaret-fill-upcaret-leftcaret-line-downcaret-line-leftcaret-line-rightcaret-line-two-downcaret-line-two-leftcaret-line-two-rightcaret-line-two-upcaret-line-upcaret-rightcaret-two-downcaret-two-leftcaret-two-rightcaret-two-upcaret-upcarousel-nextcarousel-pausecarousel-playcarousel-prevcart-deliveredcasinocc-copyrightcertificate-checkcertificate-clickcertificatecharge-cyclecharge-unitschargechat-bubblechat-bubbleschatcheck-fillcheck-linecheck-listcheck-markchemical-hazardchromechurchcityclipboardclockclose-fillclose-lineclose-markcloud-downloadcloud-gearcloud-networkcloud-servicescloud-synccloud-uploadcodecofeecollapse-allcollapsecompasscomputerconstructioncontact-uscontactscoronaviruscoughingcovercruise-shipcubescurrencydamdangerdesktop-checklistdesktop-video-moduledicesdiggingdirectionsdiscovercarddistancedo-not-signdocumentdown-leftdown-rightdowndownload-clouddownloaddragdrawerdriveear-slashearearthquakeelectricity-hazardemailentertainmentexcelexpand-allexpandexternal-linkeye-slasheyefacebookfamily-altfamilyfastfoodfavoritefeaturesferryfile-audiofile-certificatefile-checkfile-codefile-csvfile-downloadfile-excelfile-exportfile-importfile-invoicefile-medical-altfile-medicalfile-pdffile-powerpointfile-prescriptionfile-uploadfile-videofile-wordfile-zipfilefilmfilter-solidfilterfingerprint-checkfingerprintfirefirefoxfitness-altfitnessflickrfloodflowchartfolderfootballgas-pumpgeargearsgithubglassglobegolfgoogle-plusgooglegraduate-pointergraduategraphgreengridhair-salonhairhand-hearthand-moneyhand-watterhandhandshakehappyhazardhearthighwayhome-educationhome-graduatehomehourglasshours-securityhourshousehurricaneidea-altideaieimageimagesimportant-lineimportantimprovementsinfo-bubbleinfo-lineinfoinstagraminstitutejustice-legalkeylab-testslaw-enforcementleftlightbulblinklinkedinlocationlockloud-speakermagnify-glassmailmalwaremapmask-darkmask-lightmaskmastercardmedalmedical-bubblemedical-caremedical-casemedical-clinicmedical-crossmedical-doctormedical-heartmedical-pillsmedical-shippedmedicalmenu-toggle-closedmenu-toggle-openmenumicmicrosoftminus-fillminus-lineminus-markmobilemuseum-altmuseummusicnail-polishno-coughingno-handshakeno-smokingno-travelno-virusonline-educationonline-graduateonline-helponline-moduleonline-servicesoperapaddle-boatpagepalettepartypausepayment-cardpaypalpdf-textpdfpencil-editpencilpeoplepersonpersonal-carepharmacyphonepie-chartpinterestplacesplayplus-fillplus-lineplus-markpowerpointprintpro-servicesprocurementprojectpushpinpuzzle-piecepuzzlequake-hazardquake-housequestion-fillquestion-linequestionquote-fillradiationrailread-bookreaderrecycleresponsive-altresponsiverestaurantrightroad-pinroadroadwaysrssrvsafarisail-shipsciencescootersea-level-rise-altsea-level-risesearch-rightsearchsearchingsecurity-networksecurity-systemserversevere-weathershare-buttonshare-emailshare-facebookshare-flickrshare-googleplusshare-linkedinshare-pinterestshare-snapchatshare-twittershare-vimeoshare-youtubeshareshield-checkshieldshipshopping-cartsign-languageskip-backwardsskip-forwardsmartphonesmokingsnapchatsoapsoccersosspeech-dialogspeedtrainstatestay-homestop-firestop-handsuvtabletablettagsteamteamstechnology-reuseteleworkingtempletennistenttesting-alttestingthumb-uptimetooltoolstornadotraintravel-airtravel-cartriangle-downtriangle-lefttriangle-line-downtriangle-line-lefttriangle-line-righttriangle-line-uptriangle-righttriangle-uptrolleybustrophytruck-alttruck-deliverytrucktsunami-alttsunamitwitterup-leftup-rightupupdateupload-clouduser-deskuser-desktop-instructoruser-idusers-altusers-dialogusers-huddleusers-interactionusersvaccine-checkvaccine-patientvaccinevanvideo-cameravideovimeovirusvirusesvisavolcanovolumewalletwarning-circlewarning-fillwarning-squarewarning-trianglewashwordyachtyoutubezipped-filezoo-altzoozoom-inzoom-out