# Primer CSS Buttons [![npm version](http://img.shields.io/npm/v/primer-buttons.svg)](https://www.npmjs.org/package/primer-buttons) [![Build Status](https://travis-ci.org/primer/primer-css.svg?branch=master)](https://travis-ci.org/primer/primer-css) > Buttons are used for actions, like in forms, while textual hyperlinks are used for destinations, or moving from one page to another. This repository is a module of the full [primer-css][primer-css] repository. ## Install This repository is distributed with [npm][npm]. After [installing npm][install-npm], you can install `primer-buttons` with this command. ``` $ npm install --save primer-buttons ``` ## Usage The source files included are written in [Sass][sass] (`scss`) You can simply point your sass `include-path` at your `node_modules` directory and import it like this. ```scss @import "primer-buttons/index.scss"; ``` You can also import specific portions of the module by importing those partials from the `/lib/` folder. _Make sure you import any requirements along with the modules._ ## Build For a compiled **css** version of this module, a npm script is included that will output a css version to `build/build.css` The built css file is also included in the npm package. ``` $ npm run build ``` ## Documentation Buttons are used for **actions**, like in forms, while textual hyperlinks are used for **destinations**, or moving from one page to another. #### Buttons ```html



``` #### Default buttons Use the standard—yet classy—`.btn` for form actions and primary page actions. These are used extensively around the site. When using a ` Link button ``` You can find them in two sizes: the default `.btn` and the smaller `.btn-sm`. ```html ``` #### Primary Primary buttons are green and are used to indicate the *primary* action on a page. When you need your buttons to stand out, use `.btn.btn-primary`. You can use it with both button sizes—just add `.btn-primary`. ```html ``` #### Danger Danger buttons are red. They help reiterate that the intended action is important or potentially dangerous (e.g., deleting a repo or transferring ownership). Similar to the primary buttons, just add `.btn-danger`. ```html ``` #### Outline Outline buttons downplay an action as they appear like boxy links. Just add `.btn-outline` and go. ```html ``` #### Disabled state Disable ` Disabled button ``` Similar styles are applied to primary, danger, and outline buttons: ```html Disabled button ``` ```html Disabled button ``` ```html Disabled button ``` #### Block buttons Make any button full-width by adding `.btn-block`. It adds `width: 100%;`, changes the `display` from `inline-block` to `block`, and centers the button text. ```html

``` #### With counts You can easily append a count to a **small button**. Add the `.with-count` class to the `.btn-sm` and then add the `.social-count` after the button. **Be sure to clear the float added by the additional class.** ```html
<%= octicon "eye" %> Watch 6
``` You can also use the [counter](../../product/components/labels) component within buttons: ```html ``` #### Button groups Have a hankering for a series of buttons that are attached to one another? Wrap them in a `.BtnGroup` and the buttons will be rounded and spaced automatically. ```html
``` Add `.BtnGroup-form` to `
`s within `.BtnGroup`s for proper spacing and rounded corners. ```html
``` #### Hidden text button Use `.hidden-text-expander` to indicate and toggle hidden text. ```html ``` You can also make the expander appear inline by adding `.inline`. ## License [MIT](./LICENSE) © [GitHub](https://github.com/) [primer-css]: https://github.com/primer/primer [docs]: http://primercss.io/ [npm]: https://www.npmjs.com/ [install-npm]: https://docs.npmjs.com/getting-started/installing-node [sass]: http://sass-lang.com/