0.9.5 • Published 8 years ago

css-toolkit-form v0.9.5

Weekly downloads
3
License
MIT
Repository
github
Last release
8 years ago

CSS Toolkit - Form

npm version

A CSS Toolkit module that templates common structural form elements to be extended with modifier classes.

Installation

  • npm: npm install css-toolkit-form

Available Classes

Configuration

Adjust the custom properties to change the base defaults using postcss-custom-properties. For Example:

  • --form-padding: .375rem .75rem;
  • --form-color: #333;
  • --form-background: #fff;
  • --form-border-width: 1px;
  • --form-border-color: currentColor;
  • --form-vertical-rhythm: 1rem;

Use

Examples:

<form>

  <fieldset class="form-group">
    <label for="exampleInputEmail">Email address</label>
    <input type="email" class="form-control" id="exampleInputEmail" placeholder="jane.doe@example.com">
    <small>We'll never share your email with anyone else.</small>
  </fieldset>

  <fieldset class="form-group">
    <label for="exampleInputPassword">Password</label>
    <input type="password" class="form-control" id="exampleInputPassword" placeholder="Password">
  </fieldset>

  <fieldset class="form-group">
    <label for="exampleSelect1">Example select</label>
    <select class="form-control" id="exampleSelect1">
      <option>1</option>
      <option>2</option>
      <option>3</option>
      <option>4</option>
      <option>5</option>
    </select>
  </fieldset>

  <fieldset class="input-group">
    <label for="exampleTextarea">Textarea</label>
    <textarea class="form-control" id="exampleTextarea" rows="3"></textarea>
  </fieldset>

  <div class="radio">
    <label>
      <input type="radio" name="optionsRadios" id="optionsRadios1" value="option1" checked>
      Option one is this and that&mdash;be sure to include why it's great
    </label>
  </div>

  <div class="radio">
    <label>
      <input type="radio" name="optionsRadios" id="optionsRadios2" value="option2">
      Option two can be something else and selecting it will deselect option one
    </label>
  </div>

  <div class="radio disabled">
    <label>
      <input type="radio" name="optionsRadios" id="optionsRadios3" value="option3" disabled>
      Option three is disabled
    </label>
  </div>

  <div class="checkbox">
    <label>
      <input type="checkbox"> Check me out
    </label>
  </div>

</form>

Theming / Extending

As the module focuses on common structural styles, You can build your website-specific theme styles in your build process with PostCSS. For example:

@import "css-toolkit-form";

Testing

Install Node (comes with npm).

npm install

To generate a build:

npm run build

Basic visual tests are in test/index.html.

Browser Support

  • Edge
  • Firefox
  • Google Chrome
  • Internet Explorer 11+
  • Opera
  • Safari
0.9.5

8 years ago

0.9.41

8 years ago

0.9.4

8 years ago

0.9.32

8 years ago

0.9.31

8 years ago

0.9.3

8 years ago

0.9.2

8 years ago

0.9.1

8 years ago

0.9.0

8 years ago