This project is read-only.

Font Awesome for MVC Razor Tools

Font Awesome for MVC Razor Tools provides a set of objects to use Font Awesome directly in MVC Razor views. This library provides a class for creating a font, pre-defined classes for all fonts, pre-defined styles as well as extension methods for HtmlHelper.

Icons and styles can be selected using IntelliSense within Visual Studio so you do not need to lookup the class name for each icon or know the styles.

Installation

To install Font Awesome for MVC Razor Tools, run the following command in the Package Manager Console

PM> Install-Package Mvc.RazorTools.FontAwesome

Getting Started

Add this line of code to your _Layout.cshtml file or to any page where you want to display the icons. For example, place this in your layout file if you plan to show icons on all or most of the pages in your application otherwise just place it in the pages where you will be using the icons.

@Mvc.RazorTools.BundleManager.Styles.Render()


Typically you will add this near the top of the page with the other style sheets references. See below for an example.

<head>
    <meta charset="utf-8" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>@ViewBag.Title - My ASP.NET Application</title>
    @Styles.Render("~/Content/css")
    @Scripts.Render("~/bundles/modernizr")
    @Mvc.RazorTools.BundleManager.Styles.Render()
</head>


Add the namespace to your views web.config file.

<add namespace="Mvc.RazorTools.FontAwesome"/>

Simple Usage

This library uses simple syntax to display an icon. IntelliSense on the FontAwesomeIconSet will reveal the full list of icons available.

@Html.FontAwesome(FontAwesomeIconSet.Star)


To create a spinning icon just add .Spin()...

@Html.FontAwesome(FontAwesomeIconSet.Spinner.Spin())


or,

@Html.FontAwesome(FontAwesomeIconSet.Spinner, FontAwesomeStyles.Spin)


A full set of styles can be seen via IntelliSense on the FontAwesomeStyles class.

Last edited Apr 28, 2015 at 8:56 PM by porrey, version 9