You can fetch Trowel Ribbons with npm, yarn or bower.
# With bower
$ bower install --save trowel-ribbons
# With npm
$ npm install --save trowel-ribbons
# With yarn
$ yarn add trowel-ribbons
You can also download a zip archive right here.
The main scss file to include to your main .scss
file is located at the ./src/scss/ribbons.scss
. As a Trowel Component, it also requires two dependencies to compile the scss code. Here an scss installation snippet.
// Trowel core (need to be imported first)
@import './path/to/dependencies/trowel-core/src/trowel';
// Trowel Ribbons
@import './path/to/dependencies/trowel-ribbons/src/scss/ribbons';
The twig template ready to be include
or embed
is located at ./src/twig/ribbon.html.twig
.
default
<span class="ribbon">
<span class="ribbon__band">
<span class="ribbon__content">default</span>
</span>
</span>
By default the ribbon is oriented on the left, but with the .ribbon--right
class you can flip the orientation.
default
<span class="ribbon ribbon--right">
<span class="ribbon__band">
<span class="ribbon__content">default</span>
</span>
</span>
If you don't need a right orientation, or you want to change the default orientation just overwrite the trowel variable `$ribbons--position`.
By default, you have access to 5 themes :
<span class="ribbon">
<span class="ribbon__band">
<span class="ribbon__content">default</span>
</span>
</span>
<span class="ribbon ribbon--primary">
<span class="ribbon__band">
<span class="ribbon__content">primary</span>
</span>
</span>
<span class="ribbon ribbon--success">
<span class="ribbon__band">
<span class="ribbon__content">success</span>
</span>
</span>
<span class="ribbon ribbon--warning">
<span class="ribbon__band">
<span class="ribbon__content">warning</span>
</span>
</span>
<span class="ribbon ribbon--danger">
<span class="ribbon__band">
<span class="ribbon__content">danger</span>
</span>
</span>
Instead of writing html, you can embed
the twig template :
{% embed "path/to/trowel-ribbons/src/twig/ribbon.html.twig" %}
{% block content %}default{% endblock %}
{% endembed %}
If you want to add some modifiers
on the block selector (.ribbon
), you can set the array modifiers with as many modifiers as you need :
{% embed "path/to/trowel-ribbons/src/twig/ribbon.html.twig" with {
"modifiers": ["primary"]
} %}
{% block content %}primary{% endblock %}
{% endembed %}
You can override the global syntax config for a specific component with the following variables
VARIABLE | DEFAULT VALUE | DESCRIPTION |
---|---|---|
$ribbons--syntax |
null |
syntax config for .ribbon |
VARIABLE | DEFAULT VALUE | DESCRIPTION |
---|---|---|
$ribbons--font-size |
1rem |
set the font-size property |
$ribbons--font-family |
null |
set the font-family property |
$ribbons--font-weight |
null |
set the font-weight property |
$ribbons--text-transform |
null |
set the text-transform property |
$ribbons--letter-spacing |
null |
set the letter-spacing property |
$ribbons--line-height |
null |
set the line-height property |
$ribbons--text-decoration |
null |
set the text-decoration property |
$ribbons--margin |
null |
set the margin property |
$ribbons--color |
rgb(255, 255, 255) |
set the color property |
$ribbons--box-shadow |
null |
set the box-shadow property |
$ribbons--background |
null |
set the background property |
$ribbons--background-color |
( |
set the background-color property |
$ribbons--size |
7.5em |
set the width and height properties |
$ribbons--position |
( |
define the orientation of the ribbon, can only be 'left' or 'right' |
$ribbons--gutter |
3.75em |
set the gutter property |
$ribbons--height |
1.875em |
set the height property |