Icon
Help visually distinguish and provide extra meaning to certain items or actions. You can pass an icon name or mime type to generate the appropriate icon.
Pulsar currently uses Font Awesome 4.6.3. Older 3.2.1 icons are still supported and are mapped to their newer version 4 icon.
Example usage
{{ html.icon('save') }}
{{ html.icon('application/msword') }}
Options
Option | Type | Description |
---|---|---|
class | string | CSS classes, space separated |
Mime types
Supported mime types include
Type | Icon | Preview |
---|---|---|
application/msword | file-word-o | |
application/vnd.openxmlformats-officedocument.wordprocessingml.document | file-word-o | |
application/vnd.ms-excel | file-excel-o | |
application/vnd.openxmlformats-officedocument.spreadsheetml.sheet | file-excel-o | |
application/vnd.ms-powerpoint | file-powerpoint-o | |
application/vnd.ms-office | file-o | |
application/pdf | file-pdf-o | |
text/plain | file-text-o | |
text/html | file-code-o | |
application/* | file-o | |
text/* | file-text-o | |
video/* | file-movie-o | |
audio/* | file-audio-o | |
image/* | file-image-o |
Icon sizes
Icons inherit their size and colour attributes from their parents and can be nested within other helpers, like buttons, links and tabs.
<!-- Icon inherits size from parent -->
<h1>{{ html.icon('info-sign') }} Example Heading</h1>
<h2>{{ html.icon('info-sign') }} Example Heading</h2>
<h3>{{ html.icon('info-sign') }} Example Heading</h3>
<h4>{{ html.icon('info-sign') }} Example Heading</h4>
<h5>{{ html.icon('info-sign') }} Example Heading</h5>
<h6>{{ html.icon('info-sign') }} Example Heading</h6>
See the Pen docs - icons - icon headers by Pulsar (@pulsar) on CodePen.
{# Icon before the text #}
{{ html.button(html.icon('plus') ~ 'Button', 'btn--primary') }}
See the Pen GqBLwQ by Pulsar (@pulsar) on CodePen.
{# Icon after the text #}
{{ html.link('Link' ~ html.icon('ok'), '#example') }}
See the Pen docs - icons - icon link by Pulsar (@pulsar) on CodePen.
Styleguide
When using iconography you may need to use different icons to illustrate a state and the associated action which modifies the state.
See the Pen docs - icons - icon states by Pulsar (@pulsar) on CodePen.