├── .gitignore ├── Gruntfile.js ├── README.md ├── bower.json ├── dist ├── index.html └── tabsy.css ├── package.json └── src ├── index.html ├── library ├── _animations.scss ├── _mixins.scss └── _variables.scss └── tabsy.scss /.gitignore: -------------------------------------------------------------------------------- 1 | node_modules/ 2 | npm-debug.log -------------------------------------------------------------------------------- /Gruntfile.js: -------------------------------------------------------------------------------- 1 | module.exports = function(grunt) { 2 | 3 | grunt.initConfig({ 4 | 5 | settings: { 6 | srcPath: 'src/', 7 | distPath: 'dist/' 8 | }, 9 | 10 | sass: { 11 | app: { 12 | files: [{ 13 | expand: true, 14 | cwd: '<%= settings.srcPath %>', 15 | src: ['**/*.scss'], 16 | dest: '<%= settings.distPath %>', 17 | ext: '.css' 18 | }], 19 | options: { 20 | outputStyle: 'compressed', 21 | sourceMap: false, 22 | precision: 5 23 | } 24 | } 25 | }, 26 | 27 | postcss: { 28 | options: { 29 | map: false, 30 | processors: [ 31 | require('autoprefixer')({ 32 | browsers: 'last 10 versions, Explorer >= 9' 33 | }) 34 | ] 35 | }, 36 | dist: { 37 | src: '<%= settings.distPath %>*.css' 38 | } 39 | }, 40 | 41 | htmlbuild: { 42 | build: { 43 | expand: true, 44 | cwd: '<%= settings.srcPath %>', 45 | src: '**/*.html', 46 | dest: '<%= settings.distPath %>' 47 | } 48 | }, 49 | 50 | watch: { 51 | scss: { 52 | expand: true, 53 | files: ['<%= settings.srcPath %>sass/**/*.scss'], 54 | tasks: ['sass', 'postcss'], 55 | options: { 56 | spawn: false 57 | } 58 | }, 59 | html: { 60 | files: ['<%= settings.srcPath %>*.html'], 61 | tasks: ['htmlbuild'], 62 | options: { 63 | spawn: false 64 | } 65 | } 66 | } 67 | 68 | }); 69 | 70 | require('load-grunt-tasks')(grunt); 71 | 72 | grunt.registerTask('default', ['watch']); 73 | grunt.registerTask('build', ['sass', 'postcss', 'htmlbuild']); 74 | 75 | }; -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # Tabsy CSS # 2 | ## Simple tabs toggler component written in pure CSS with no dependencies ## 3 | 4 | 5 | ### Install ### 6 | 7 | With npm: 8 | ```sh 9 | npm install tabsy-css 10 | ``` 11 | 12 | With Bower: 13 | ```sh 14 | bower install tabsy-css 15 | ``` 16 | 17 | ### Usage ### 18 | 19 | Include css: 20 | ```sh 21 | 22 | ``` 23 | 24 | Initial required structure, place any content you want within the tabs: 25 | ```sh 26 |
27 | 28 | 29 |
30 |
31 | Content One 32 |
33 |
34 | 35 | 36 |
37 |
38 | Content Two 39 |
40 |
41 | 42 | 43 |
44 |
45 | Content Three 46 |
47 |
48 |
49 | ``` 50 | 51 | ### Demo ### 52 | 53 | Demo available [here](http://robiveli.github.io/tabsy-css/). 54 | 55 | ### Options ### 56 | 57 | Default css settings are placed in `library/_variables.scss`: 58 | 59 | ### Note ### 60 | 61 | Based on Flexbox feature. Where not supported simple fallback is applied. 62 | 63 | ### License ### 64 | 65 | Tabsy CSS is licensed under the [MIT license](http://opensource.org/licenses/MIT). 66 | -------------------------------------------------------------------------------- /bower.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "tabsy-css", 3 | "version": "1.0.0", 4 | "description": "Simple tabs toggler component written in pure CSS with no dependencies", 5 | "main": [ 6 | "dist/", 7 | "src/", 8 | "Gruntfile.js", 9 | "package.json", 10 | "README.md" 11 | ], 12 | "authors": [ 13 | "Robert Velickovski" 14 | ], 15 | "license": "MIT", 16 | "keywords": [ 17 | "tabs", 18 | "css", 19 | "toggle", 20 | "simple", 21 | "lightweight" 22 | ], 23 | "homepage": "https://github.com/robiveli/tabsy-css", 24 | "ignore": [ 25 | "**/.*", 26 | "node_modules", 27 | "bower_components", 28 | "test", 29 | "tests" 30 | ] 31 | } 32 | -------------------------------------------------------------------------------- /dist/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | Tabsy - Simple tabs toggler component written in pure CSS with no dependencies 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 99 | 100 | 101 | 102 | 103 | 104 |
105 | 106 |

Tabsy [CSS]

107 |

Simple and lightweight tabs toggler component written in pure CSS

108 | 109 |
110 | 111 | 112 | 113 | 114 |
115 |
116 |

Heading 1

117 |

Lorem Ipsum is simply dummy text of the printing and typesetting industry.

118 |

Lorem Ipsum has been the industry's standard dummy text ever since the 1500s, when an unknown printer took a galley of type and scrambled it to make a type specimen book. It has survived not only five centuries, but also the leap into electronic typesetting, remaining essentially unchanged.

119 |
120 |
121 | 122 | 123 | 124 | 125 |
126 |
127 |

Heading 2

128 |

Lorem Ipsum has been the industry's standard dummy text ever since the 1500s, when an unknown printer took a galley of type and scrambled it to make a type specimen book. It has survived not only five centuries, but also the leap into electronic typesetting, remaining essentially unchanged.

129 |

Lorem Ipsum has been the industry's standard dummy text ever since the 1500s, when an unknown printer took a galley of type and scrambled it to make a type specimen book. It has survived not only five centuries, but also the leap into electronic typesetting, remaining essentially unchanged.

130 |

Lorem Ipsum has been the industry's standard dummy text ever since the 1500s, when an unknown printer took a galley of type and scrambled it to make a type specimen book. It has survived not only five centuries, but also the leap into electronic typesetting, remaining essentially unchanged.

131 |
132 |
133 | 134 | 135 | 136 | 137 |
138 |
139 |

Heading 3

140 |

Lorem Ipsum has been the industry's standard dummy text ever since the 1500s, when an unknown printer took a galley of type and scrambled it to make a type specimen book. It has survived not only five centuries, but also the leap into electronic typesetting, remaining essentially unchanged.

141 |

Lorem Ipsum has been the industry's standard dummy text ever since the 1500s, when an unknown printer took a galley of type and scrambled it to make a type specimen book. It has survived not only five centuries, but also the leap into electronic typesetting, remaining essentially unchanged. Lorem Ipsum has been the industry's standard dummy text ever since the 1500s, when an unknown printer took a galley of type and scrambled it to make a type specimen book. It has survived not only five centuries, but also the leap into electronic typesetting, remaining essentially unchanged. Lorem Ipsum has been the industry's standard dummy text ever since the 1500s, when an unknown printer took a galley of type and scrambled it to make a type specimen book. It has survived not only five centuries, but also the leap into electronic typesetting, remaining essentially unchanged.

142 |
143 |
144 | 145 |
146 | 147 |
148 | 149 | 150 | 151 | -------------------------------------------------------------------------------- /dist/tabsy.css: -------------------------------------------------------------------------------- 1 | @-webkit-keyframes showTab{from{opacity:0;-webkit-transform:translateY(10px);transform:translateY(10px)}to{opacity:1;-webkit-transform:translateY(0);transform:translateY(0)}}@keyframes showTab{from{opacity:0;-webkit-transform:translateY(10px);transform:translateY(10px)}to{opacity:1;-webkit-transform:translateY(0);transform:translateY(0)}}.tabsy>button{width:100%;font-family:inherit;font-size:100%;margin:0;outline:0;border:0;vertical-align:baseline;-webkit-box-sizing:border-box;box-sizing:border-box;background:transparent}.tabsy>.tabButton{display:block;margin-top:1px;background:#5a5243;color:#f5f5f5;text-align:center;-webkit-transition:all 250ms ease-in-out;transition:all 250ms ease-in-out}.tabsy>input{display:none}.tabsy>input:checked+label+.tab{display:block}.tabsy>input:checked+label+.tab>.content{-webkit-animation:showTab 250ms ease-in-out;animation:showTab 250ms ease-in-out}.tabsy>.tab{background:#fff;display:none}@media screen and (min-width: 768px){.tabsy{display:-webkit-box;display:-webkit-flex;display:-ms-flexbox;display:flex;-webkit-flex-wrap:wrap;-ms-flex-wrap:wrap;flex-wrap:wrap}.tabsy>.tabButton{-webkit-box-ordinal-group:2;-webkit-order:1;-ms-flex-order:1;order:1;-webkit-box-align:start;-webkit-align-items:flex-start;-ms-flex-align:start;align-items:flex-start;cursor:pointer}.tabsy>input:checked+label{background:#fff;color:#5a5243}.tabsy>.tab{-webkit-box-ordinal-group:3;-webkit-order:2;-ms-flex-order:2;order:2}} 2 | -------------------------------------------------------------------------------- /package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "tabsy-css", 3 | "title": "Tabsy CSS", 4 | "description": "Simple tabs toggler component written in pure CSS with no dependencies", 5 | "version": "1.0.0", 6 | "license": "MIT", 7 | "author": { 8 | "name": "Robert Velickovski", 9 | "email": "roby@rvdizajn.com" 10 | }, 11 | "keywords": [ 12 | "tabs", 13 | "css", 14 | "simple", 15 | "toggle", 16 | "lightweight" 17 | ], 18 | "homepage": "https://github.com/robiveli/tabsy-css", 19 | "devDependencies": { 20 | "autoprefixer": "^6.7.7", 21 | "grunt": "^1.0.1", 22 | "grunt-contrib-watch": "^1.0.0", 23 | "grunt-html-build": "^0.7.1", 24 | "grunt-postcss": "^0.8.0", 25 | "grunt-sass": "^2.0.0", 26 | "load-grunt-tasks": "^3.5.2" 27 | } 28 | } 29 | -------------------------------------------------------------------------------- /src/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | Tabsy - Simple tabs toggler component written in pure CSS with no dependencies 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 99 | 100 | 101 | 102 | 103 | 104 |
105 | 106 |

Tabsy [CSS]

107 |

Simple and lightweight tabs toggler component written in pure CSS

108 | 109 |
110 | 111 | 112 | 113 | 114 |
115 |
116 |

Heading 1

117 |

Lorem Ipsum is simply dummy text of the printing and typesetting industry.

118 |

Lorem Ipsum has been the industry's standard dummy text ever since the 1500s, when an unknown printer took a galley of type and scrambled it to make a type specimen book. It has survived not only five centuries, but also the leap into electronic typesetting, remaining essentially unchanged.

119 |
120 |
121 | 122 | 123 | 124 | 125 |
126 |
127 |

Heading 2

128 |

Lorem Ipsum has been the industry's standard dummy text ever since the 1500s, when an unknown printer took a galley of type and scrambled it to make a type specimen book. It has survived not only five centuries, but also the leap into electronic typesetting, remaining essentially unchanged.

129 |

Lorem Ipsum has been the industry's standard dummy text ever since the 1500s, when an unknown printer took a galley of type and scrambled it to make a type specimen book. It has survived not only five centuries, but also the leap into electronic typesetting, remaining essentially unchanged.

130 |

Lorem Ipsum has been the industry's standard dummy text ever since the 1500s, when an unknown printer took a galley of type and scrambled it to make a type specimen book. It has survived not only five centuries, but also the leap into electronic typesetting, remaining essentially unchanged.

131 |
132 |
133 | 134 | 135 | 136 | 137 |
138 |
139 |

Heading 3

140 |

Lorem Ipsum has been the industry's standard dummy text ever since the 1500s, when an unknown printer took a galley of type and scrambled it to make a type specimen book. It has survived not only five centuries, but also the leap into electronic typesetting, remaining essentially unchanged.

141 |

Lorem Ipsum has been the industry's standard dummy text ever since the 1500s, when an unknown printer took a galley of type and scrambled it to make a type specimen book. It has survived not only five centuries, but also the leap into electronic typesetting, remaining essentially unchanged. Lorem Ipsum has been the industry's standard dummy text ever since the 1500s, when an unknown printer took a galley of type and scrambled it to make a type specimen book. It has survived not only five centuries, but also the leap into electronic typesetting, remaining essentially unchanged. Lorem Ipsum has been the industry's standard dummy text ever since the 1500s, when an unknown printer took a galley of type and scrambled it to make a type specimen book. It has survived not only five centuries, but also the leap into electronic typesetting, remaining essentially unchanged.

142 |
143 |
144 | 145 |
146 | 147 |
148 | 149 | 150 | 151 | -------------------------------------------------------------------------------- /src/library/_animations.scss: -------------------------------------------------------------------------------- 1 | @include keyframes(showTab) { 2 | 3 | from { 4 | 5 | opacity: 0; 6 | transform: translateY(10px); 7 | 8 | } 9 | 10 | to { 11 | 12 | opacity: 1; 13 | transform: translateY(0); 14 | 15 | } 16 | 17 | } -------------------------------------------------------------------------------- /src/library/_mixins.scss: -------------------------------------------------------------------------------- 1 | // keyframes 2 | @mixin keyframes($animation-name) { 3 | 4 | @-webkit-keyframes #{$animation-name} { 5 | 6 | @content; 7 | 8 | } 9 | 10 | @keyframes #{$animation-name} { 11 | 12 | @content; 13 | 14 | } 15 | 16 | } 17 | 18 | // animation 19 | @mixin animation($args) { 20 | 21 | -webkit-animation: #{$args}; 22 | animation: #{$args}; 23 | 24 | } -------------------------------------------------------------------------------- /src/library/_variables.scss: -------------------------------------------------------------------------------- 1 | // Base Colors 2 | $tabActiveBgColor: #fff; 3 | $tabActiveTextColor: #5a5243; 4 | $tabNectiveBgColor: #5a5243; 5 | $tabNectiveTextColor: #F5F5F5; 6 | 7 | // Breakpoint 8 | $breakpoint: 768px; 9 | 10 | // Transition 11 | $transitionSpeed: 200ms; -------------------------------------------------------------------------------- /src/tabsy.scss: -------------------------------------------------------------------------------- 1 | // Library 2 | @import 'library/variables'; 3 | @import 'library/mixins'; 4 | @import 'library/animations'; 5 | 6 | .tabsy { 7 | 8 | > button { 9 | 10 | width: 100%; font-family: inherit; font-size: 100%; margin: 0; outline: 0; border: 0; 11 | vertical-align: baseline; box-sizing: border-box; background: transparent; 12 | 13 | } 14 | 15 | > .tabButton { 16 | 17 | display: block; margin-top: 1px; background: $tabNectiveBgColor; color: $tabNectiveTextColor; text-align: center; 18 | transition: all $transitionSpeed ease-in-out; 19 | 20 | } 21 | 22 | > input { 23 | 24 | display: none; 25 | 26 | &:checked + label { 27 | 28 | & + .tab { 29 | 30 | display: block; 31 | 32 | > .content { 33 | 34 | @include animation(showTab $transitionSpeed ease-in-out); 35 | 36 | } 37 | 38 | } 39 | 40 | } 41 | 42 | } 43 | 44 | > .tab { 45 | 46 | background: $tabActiveBgColor; display: none; 47 | 48 | } 49 | 50 | @media screen and (min-width: $breakpoint) { 51 | 52 | display: flex; flex-wrap: wrap; 53 | 54 | > .tabButton { 55 | 56 | order: 1; align-items: flex-start; cursor: pointer; 57 | 58 | } 59 | 60 | > input { 61 | 62 | &:checked + label { 63 | 64 | background: $tabActiveBgColor; color: $tabActiveTextColor; 65 | 66 | } 67 | 68 | } 69 | 70 | > .tab { 71 | 72 | order: 2; 73 | 74 | } 75 | 76 | } 77 | 78 | } --------------------------------------------------------------------------------