You can fetch Trowel Buttons with npm, yarn or bower.
# With bower
$ bower install --save trowel-buttons
# With npm
$ npm install --save trowel-buttons
# With yarn
$ yarn add trowel-buttons
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/buttons.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 Component Buttons
@import './path/to/dependencies/trowel-buttons/src/scss/buttons';
You can put the .btn
classes <a>
, <button>
and <input>
DOM elements.
<a class="btn btn--default" href="#" role="button">Link</a>
<button class="btn btn--default" type="submit">Button</button>
<input class="btn btn--default" type="button" value="Input">
<input class="btn btn--default" type="submit" value="Submit">
By default you have 4 sizes availables :
Here, the sizes are just made with the `$button--font-size` variable : we create a default value, and 3 modifiers flags value. Padding are made with `em` units, so it scales to the font-size value.
<button class="btn btn--default btn--lg">button lg</button>
<button class="btn btn--default">button md</button>
<button class="btn btn--default btn--sm">button sm</button>
<button class="btn btn--default btn--xs">button xs</button>
By default you have 6 different themes for the .btn
.
The themes are designed with the variables $button--color
, $button--border-color
and $button--background-color
.
<button class="btn btn--default">default</button>
<button class="btn btn--primary">primary</button>
<button class="btn btn--success">success</button>
<button class="btn btn--warning">warning</button>
<button class="btn btn--danger">danger</button>
<button class="btn btn--link">link</button>
You can make the button size equal to its container size with the .btn--block
class.
this class is designed with a modifier flag on two trowel variables : ` $button--display` as `block`, and `$button--width` as `100%`.
<button class="btn btn--primary btn--block">btn block</button>
You can group button by just wrapping them in a .btn-group
DOM element
The btn-group is design with flexbox. Check out the btn-groups variables to custom its behavior.
<div class="btn-group">
<button class="btn btn--default">first button</button>
<button class="btn btn--default">second button</button>
<button class="btn btn--default">third button</button>
</div>
You can override the global syntax config for a specific component with the following variables
VARIABLE | DEFAULT VALUE | DESCRIPTION |
---|---|---|
$button--syntax |
null |
syntax config for .btn |
You can avoid the generation of some css with the following variables
VARIABLE | DEFAULT VALUE | DESCRIPTION |
---|---|---|
$buttongroup--enabled |
true |
enable the generation of style rules for the .btn-group block |
VARIABLE | DEFAULT VALUE | DESCRIPTION |
---|---|---|
$button--vertical-align |
middle |
sets the vertical-align property |
$button--float |
null |
sets the float property |
$button--display |
( |
sets the display property |
$button--border-width |
1px |
sets the float property |
$button--padding |
0.65em 1.65em |
sets the padding property |
$button--width |
( |
sets the padding property |
$button--margin |
null | sets the margin property |
$button--height |
null | sets the height property |
$button--color |
( |
sets the color property |
$button--border-color |
( |
sets the border-color property |
$button--background-color |
( |
sets the background-color property |
$button--opacity |
( |
sets the opacity property |
$button--font-size |
( |
sets the font-size property |
$button--text-decoration |
( |
sets the text-decoration property |
$button--line-height |
1.2 |
sets the line-height property |
$button--text-align |
center |
sets the text-align property |
$button--font-family |
'Open Sans', verdana, sans-serif |
sets the font-family property |
$button--font-weight |
null |
sets the font-weight property |
$button--text-transform |
null |
sets the text-transform property |
$button--letter-spacing |
null |
sets the letter-spacing property |
$button--border-radius |
0.2em |
sets the border-radius property |
$button--border-style |
solid |
sets the border-style property |
$button--box-shadow |
null |
sets the box-shadow property |
$button--transition |
null |
sets the transition property |
$button--cursor |
null |
sets the cursor property |
VARIABLE | DEFAULT VALUE | DESCRIPTION |
---|---|---|
$buttongroup--justify-content |
null |
sets the justify-content property on block .btn-group |
$buttongroup-item--flex-grow |
null |
sets the flex-grow property on a .btn inside a .btn-group block |