# Primer Forms [![npm version](http://img.shields.io/npm/v/primer-forms.svg)](https://www.npmjs.org/package/primer-forms) [![Build Status](https://travis-ci.org/primer/primer.svg?branch=master)](https://travis-ci.org/primer/primer) > Style individual form controls and utilize common layouts. This repository is a module of the full [primer][primer] repository. ## Install This repository is distributed with [npm][npm]. After [installing npm][install-npm], you can install `primer-forms` with this command. ``` $ npm install --save primer-forms ``` ## 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-forms/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 Style individual form controls and utilize common layouts. - We reset several elements' default styles for cross browser consistency and easier manipulation later. This includes `
`s, WebKit validation bubbles, and most textual ``s. - Specific types of textual ``s are styled automatically, but `.form-control` is available should you need it. - Always declare a `type` on your `

``` #### Example form Form controls in Primer currently have no basic layout specified (this is by design). You'll need to use `
`s, `
`s, or other elements and styles to rearrange them. ```html
``` #### Form contrast Textual form controls have a white background by default. You can change this to a light gray with `.input-contrast`. ```html
``` #### Sizing Make inputs smaller, larger, or full-width with an additional class. ##### Small ```html
``` ##### Large ```html
``` ##### Block ```html
``` ##### Hide webkit's contact info autofill icon Webkit sometimes gets confused and tries to add an icon/dropdown to autofill contact information on fields that may not be appropriate (such as input for number of users). Use this class to override the display of this icon. ```html
``` #### Selects Primer adds light `height` and `vertical-align` styles to ` ``` ##### Small Use the `.select-sm` class to resize both default and custom ` ``` #### Form groups ```html
``` #### Form group validation Convey errors and warnings for form groups. Add the appropriate class—either `.errored` or `.warn`—to the `
` to start. Then, house your error messaging in an additional `
` with either `.error` or `.warning`. ```html
This example input has an error.

This example input has a warning.
``` #### Checkboxes and radios Utilities to spice up the alignment and styling of checkbox and radio controls. ```html

This will do insanely awesome and amazing things!

``` You may also add emphasis to the label: ```html
``` ##### Show / hide content based on a checkbox or radio button state Content that is hidden by default should only be done so if it is non-essential for the context of the surrounding content. Be sure to use the `aria-live="polite"` attribute on the parent label for added content to be announced when displayed. ```html
``` #### Input group Attached an input and button to one another. ```html
``` #### Form actions Align buttons to the right—via `float: right` on the buttons—in forms with `.form-actions`. The floats are automatically cleared for you. ```html
``` ## License [MIT](./LICENSE) © [GitHub](https://github.com/) [primer]: https://github.com/primer/primer [docs]: http://primer.github.io/ [npm]: https://www.npmjs.com/ [install-npm]: https://docs.npmjs.com/getting-started/installing-node [sass]: http://sass-lang.com/