|
| 1 | +# bootstrap-layout |
| 2 | + |
| 3 | +Bootstrap layout with sidebar navigation, skins, transitions, custom scrollbars, sidebar menu utilities and other advanced features. |
| 4 | + |
| 5 | +## Usage |
| 6 | + |
| 7 | +### Basic install |
| 8 | +> Simple install via npm: |
| 9 | +
|
| 10 | +```bash |
| 11 | +npm install bootstrap-layout |
| 12 | +``` |
| 13 | + |
| 14 | +### Basic usage |
| 15 | + |
| 16 | +```html |
| 17 | +<!-- Before closing the <head> tag --> |
| 18 | +<!-- After Bootstrap's CSS --> |
| 19 | +<style rel="stylesheet" href="dist/bootstrap-layout.css"> |
| 20 | +
|
| 21 | +<!-- Before closing the <body> tag --> |
| 22 | +<!-- After jQuery --> |
| 23 | +<script src="dist/bootstrap-layout.js"></script> |
| 24 | +``` |
| 25 | +
|
| 26 | +### Using the source (Sass) |
| 27 | +
|
| 28 | +#### Dependencies |
| 29 | +
|
| 30 | +> If you need to use to customise the Sass source files, you also have to install some dependencies: |
| 31 | +
|
| 32 | +```bash |
| 33 | +npm install bootstrap-layout \ |
| 34 | + bootstrap@v4.0.0-alpha.2 \ |
| 35 | + sass-md-colors |
| 36 | +``` |
| 37 | +
|
| 38 | +#### Importing Sass files from node_modules |
| 39 | +
|
| 40 | +> We import Sass files from other packages installed through npm. |
| 41 | +
|
| 42 | +```sass |
| 43 | +// For example, load bootstrap variables from node_modules/bootstrap: |
| 44 | +@import 'bootstrap/scss/variables'; |
| 45 | +``` |
| 46 | +
|
| 47 | +For this to work with your Sass compiler, you'll need to use something like [sass-importer-npm](https://github.com/themekit/sass-importer-npm) (for node-sass) |
| 48 | +
|
| 49 | +
|
| 50 | +### Layout |
| 51 | +> At minimum, the following structure is required: |
| 52 | +
|
| 53 | +- `html` tags require the `.bootstrap-layout` class |
| 54 | +- a layout wrapper container with the `.layout-container` class (also works when applied to `body`) |
| 55 | +- a layout content container with the `.layout-content` class |
| 56 | +
|
| 57 | +```html |
| 58 | +<!DOCTYPE html> |
| 59 | +<html class="bootstrap-layout"> |
| 60 | +<head> |
| 61 | + ... |
| 62 | +</head> |
| 63 | +
|
| 64 | +<body class="layout-container"> |
| 65 | + |
| 66 | + <!-- Content --> |
| 67 | + <div class="layout-content"> |
| 68 | + <div class="container-fluid"> |
| 69 | + ... |
| 70 | + </div> |
| 71 | + </div> |
| 72 | + |
| 73 | +</body> |
| 74 | +</html> |
| 75 | +``` |
| 76 | +
|
| 77 | +### Sidebar |
| 78 | +
|
| 79 | +- sidebars require the `.sidebar` class |
| 80 | +- sidebars require a unique `id` attribute |
| 81 | +- Add `data-position="left|right"` for positioning (defaults to left) |
| 82 | +- Add `data-size="2|3"` for the sidebar width (defaults to 3) |
| 83 | +- Add `data-visible="..."` attribute for automatic sidebar toggle on screen size breakpoints, for example `md lg md-up lg-up` in any combination. Defaults to `md-up`. Can also be `none` to disable. |
| 84 | +
|
| 85 | +```html |
| 86 | +<div class="sidebar" |
| 87 | + id="my-sidebar" |
| 88 | + data-position="left" |
| 89 | + data-size="3" |
| 90 | + data-visible="md-up"> |
| 91 | + ... |
| 92 | +</div> |
| 93 | +``` |
| 94 | +
|
| 95 | +#### JavaScript |
| 96 | +
|
| 97 | +```js |
| 98 | +// Enable sidebars |
| 99 | +BootstrapLayout.Sidebar.init() |
| 100 | +``` |
| 101 | +
|
| 102 | +#### Sidebar toggle buttons |
| 103 | +
|
| 104 | +> Note the sidebar container element requires a unique `id` attribute. |
| 105 | +
|
| 106 | +```html |
| 107 | +<button class="btn btn-default" |
| 108 | + data-toggle="sidebar" |
| 109 | + data-target="#my-sidebar"> |
| 110 | + Toggle |
| 111 | +</button> |
| 112 | +``` |
| 113 | +
|
| 114 | +### Custom scrollbars |
| 115 | +
|
| 116 | +#### HTML |
| 117 | +
|
| 118 | +Add `data-scrollable` HTML5 attribute to any element to enable custom scrollbars. Also, recommended for `.layout-content` and `.sidebar` elements. |
| 119 | +
|
| 120 | +#### JavaScript |
| 121 | +
|
| 122 | +```js |
| 123 | +// Enable custom scrollbars |
| 124 | +BootstrapLayout.Scrollable() |
| 125 | +``` |
0 commit comments