Skip to content

Latest commit

 

History

History
32 lines (23 loc) · 851 Bytes

README.md

File metadata and controls

32 lines (23 loc) · 851 Bytes

Stacks-Icons

dotnet add package StackExchange.StacksIcons

This package provides an SVG helper for use in Razor and other contexts:

@using StackExchange.StacksIcons

<div>
  // icons and spots return an `HtmlString` for safe use in Razor
  @Svg.Accessibility
  @Svg.Spot.Wave

  // the `With` method can take css classes and title text to add to the svg
  @Svg.AlertCircle.With(cssClass: "fc-danger", title: "foo")
</div>

Enum definitions and lookup dictionaries for all icons/spots are also provided:

using StackExchange.StacksIcons;

StacksIcon iconName = StacksIcon.Accessibility;
HtmlString icon = Svg.Lookup[iconName]; // icon is now set to the value in Svg.Accessibility

StacksSpot spotName = StacksSpot.Wave;
HtmlString spot = Svg.Spot.Lookup[spotName]; // spot is now set to the value in Svg.Spot.Wave