Neue Kit (German for new, said like "noya") is a performance focused, ITCSS based scaleable front-end kit. It's built for the modern web and only supports modern browsers although we are dragging IE11 along too! It includes a flex based fluid grid, common comprehendible JavaScript plugins and a minimalist style for all your friendly neighbourhood web elements.
There are 2 routes to get going with Neue Kit, you can either spin up a clean project with the Neue Kit structure or you can simply add the Neue Kit NPM package to your existing project.
npm install -g degit
degit neuekit/neuekit-starter yourprojectfolder
npm install
npm start
npm install neuekit --save
npm start
Neue Kit really is built for the modern web and as such only supports the cool kid browsers... and that kid who sits in the corner and eats flies.
Of course you can adjust the supported browsers by filling in the package.json browserlist config. Both the CSS and JS are configurable in this manner. See our default config on browserl.ist
- Chrome 49+
- Safari 12+
- iOS Safari 11+
- Firefox 63+
- Samsung 4+
- Opera 56+
- Edge 17+
- Internet Explorer 11+
- UC Browser 11.8+
Inverted triangle CSS is a way to architect your styles. It focusses on organising your styles in order of reach and specificity, which makes your stylesheets easier to deal with. It aims to fix a classic CSS problem, coming back to a previous project or inheriting one and not knowing where new styles should go in the stylesheet. This is most commonly solved by adding them to the end of the sheet, which is less than desirable.
The grid system is simple to use, can create a wide range of layouts and utilises a mixture of settings and utilities to allow ultimate flexibility. Oh they are infinitely nest-able too!
The Neue Kit grid system is built with flex and with our handy utilities we can make use of all of the benefits that flex has to offer.
Here is a super simple grid declaration with a single full width column. By default a single column will try to take up 100% of the width of the parent.
<div class="o-grid">
<div class="o-grid__item"></div>
</div>
<div class="o-grid o-grid--item"></div>
Let's take a look at a grid with a few columns and an alignment class for good measure. This declaration will define 4 columns, centre aligned (see alignment utilities).
On mobile each column will be 100%, on tablets it will change to 50% per column and on desktop 25% per column. There are 12 size classes in the default setup, which can be changed to any number, along with gutter sizes too.
<div class="o-grid u-alignCenter@l">
<div class="o-grid__item u-size-6@m u-size-3@l"></div>
<div class="o-grid__item u-size-6@m u-size-3@l"></div>
<div class="o-grid__item u-size-6@m u-size-3@l"></div>
<div class="o-grid__item u-size-6@m u-size-3@l"></div>
</div>
There are a whole heap of classes you can use to customise the grid to your liking, these are added top level alongside your o-grid
class:
o-grid--item
This can be used if you only need a single column, which saves a div πo-grid--max
This removes themax-width
restriction on the grid, making it fill the screen.o-grid--edge
This strips the gutters from your columns, enabling them to go edge-to-edge.o-gridβ-unnest
This doubles the negative margin which may be needed to reverse nested grid padding.o-grid--nest
This does the opposite of the above and allows a nested grid to be inset visually.o-grid--items-2
Addingitems
plural and specifying a number sets the columns at the parent level...
You can layout your grid at the parent level if your columns are all the same width, you can even do this for each breakpoint. This can be especially helpful if you don't know the number of columns you have to display, if they are pulled dynamically for example.
<div class="o-grid o-grid--items-6@m o-grid--items-3@l">
<div class="o-grid__item"></div>
<div class="o-grid__item"></div>
<div class="o-grid__item"></div>
<div class="o-grid__item"></div>
</div>
As shown above the grid makes use of the size utility classes, which are not restricted to the grid. You can customise the number of size classes in the settings layer. (See size utilities) Here's a broad example of the default available size classes and how you may apply them to the grid.
<div class="o-grid">
<div class="o-grid__item u-size-6@s u-size-3@m u-size-2@l u-size-1@xl"></div>
<div class="o-grid__item u-size-6@s u-size-3@m u-size-2@l u-size-1@xl"></div>
<!-- Repeat -->
</div>
<div class="o-grid">
<div class="o-grid__item u-size-4"></div>
<div class="o-grid__item u-size-auto"></div>
<div class="o-grid__item u-size-auto"></div>
</div>
u-size-auto
fills the remaining space and if you use more than one the space is divided up and shared equally among them.
One of the strengths of pulling helpers out into utilities is that we can use them with anything. Neue Kit comes with utilities for all sorts of things, and flex utilities come in handy when defining your layouts.
<div class="o-grid u-alignCenter u-between u-justifyCenter@l">
<div class="o-grid__item u-size-6 u-size-2@m">
<div class="o-grid__item u-size-4@m">
<div class="o-grid__item u-size-6 u-size-2@m">
</div>
Head over to the utilities section to see the full range of helpers on offer and how you can use them in your project.
Sometimes if your designer is feeling particularly edgy they may create a wonderful arymetric page layout with areas that are being pulled and pushed outside the confines of the grid.. and you need to somehow create this using a grid system π³
This is where the offset utility can help you out!
<div class="o-grid">
<div class="o-grid__item u-size-8@l u-outsetLeft-2@l"></div>
<div class="o-grid__item u-size-6@l"></div>
</div>
<div class="o-grid">
<div class="o-grid__item u-size-4@l u-inset-2@l"></div>
<div class="o-grid__item u-size-7@l u-outsetRight-1@l"></div>
</div>
Usage of the grid mixin is simple, you can import it like so:
@include nu-object__grid();
Or you can go anonymous and import the guts of the object without the parent class name, this is super useful when you want to make serious changes to a Neue Kit mixin.
.mySuperGrid {
@include _nu-object__grid();
}
Parameter | Type | Default | Description |
---|---|---|---|
$gutter | Pixel Value | 8px | Sets the gap between grid items |
$gutterSmall | Pixel Value | 8px | Enables a different gap on mobile |
$mediumBreakpoint | String | m | The point at which the gutter change happens |
$maxWidth | Pixel Value | 1380px | Sets the maximum width of the grid container |
The utility layer is home to many small css classes, that ordinarily take on a single simple task. This layer edges towards the end sharper point of the itcss triangle and as such it is not uncommon for classes to be doubled to ensure they are more specific than nest classes.
This utility creates simple potentially helpful classes that you can use to set the background colour or text colour of any element. These are created based on the colour variables set out in the settings layer.
<figure class="u-bgNoir">
<img src="michael.jpg" alt="Michael Scott">
<figcaption class="u-colourSnow">You don't know how high I can fly</figcaption>
</figure>
As mentioned the utility relies on a scss map declared as $palette
see the following example for how to declare said map.
$palette: (
'primary': $primary,
'secondary': $secondary,
'tertiary': $tertiary,
'quaternary': $quaternary
);
Parameter | Type | Default | Description |
---|---|---|---|
$palette | Setting Var | $palette | Passes in the project colour palette map |
$lightnessTolerance | Integer | 50 | Sets threshold for the level of darkness a background colour must have before setting the text to a light colour |
$lightnessColour | String | white | Colour to apply to text on dark background colours |
$utilities | Map | (background, colour) | Map defining which classes to create |
There are a fair few flex helpers to help you create a wide variety of layouts.
u-flex
Addsdisplay: flex
to any elementu-inflex
Addsdisplay: inline-flex
to any element
Available in breakpoint format eg. u-row@xs
, u-row@s
, u-row@m
, u-row@l
, u-row@xl
u-row
addsflex-direction: row
u-column
addsflex-direction: column
u-rowRevers
addsflex-direction: row-reverse
u-columnReverse
addsflex-direction: column-reverse
u-justifyStart
addsjustify-content: flex-start
u-justifyCenter
addsjustify-content: center
u-justifyEnd
addsjustify-content: flex-end
u-alignStart
addsalign-items: flex-start
u-alignCenter
addsalign-items: center
u-alignEnd
addsalign-items: flex-end
u-around
addsjustify-content: space-around
u-between
addsjustify-content: space-between
u-wrap
addsflex-wrap: wrap
u-nowrap
addsflex-wrap: nowrap
Available in breakpoint format eg. u-grow@xs
, u-grow@s
, u-grow@m
, u-grow@l
, u-grow@xl
u-grow
addsflex-grow: 1
u-noGrow
addsflex-grow: 0
u-shrink
addsflex-shrink: 1
u-noShrink
addsflex-shrink: 0
u-alignSelfStart
addsalign-self: flex-start
u-alignSelfCenter
addsalign-self: center
u-alignSelfEnd
addsalign-self: flex-end
u-first
addsorder: -1
u-last
addsorder: 1
Parameter | Type | Default | Description |
---|---|---|---|
$responsive | Map | (up, only) | Sets the responsive rules for class generation |
Offsets enable you to pull and push items around, especially useful when you need to create artistic layouts with the grid. Although these can be used anywhere.
Available in breakpoint format eg. u-inset-1@xs
, u-inset-1@s
, u-inset-1@m
, u-inset-1@l
, u-inset-1@xl
Classes end in a number, 1-12 by default, reflective of the number of columns configured
u-inset-1
applies a positive left margin as a percentage to any elementu-outsetLeft-1
applies a negative left margin as a percentage to any elementu-outsetRight-1
applies a negative right margin as a percentage to any element
Parameter | Type | Default | Description |
---|---|---|---|
$responsive | Map | (up, only) | Sets the responsive rules for class generation |
A size class sets the flex basis property of a flex child. It can be used to set the width of any element also. Typically this is matched with the grid, but is not limited to the gird.
Available in breakpoint format eg. u-size-1@xs
, u-size-1@s
, u-size-1@m
, u-size-1@l
, u-size-1@xl
Classes end in a number, 1-12 by default, reflective of the number of columns configured
u-size-auto
applies flex grow to the element, filling the available spaceu-size-1
applies flex basis as a percentage to any flex child element
Parameter | Type | Default | Description |
---|---|---|---|
$responsive | Map | (up, only) | Sets the responsive rules for class generation |
The need for declarative margin and padding helpers comes around for more frequently than we would like to admit. Neue Kit has a mixin that can create the classes for you.
To start there a few non-breakpoint classes for the safe padding area, often required for devices like the iPhone X as a way to deal with the notch.
u-safeArea-l
applies padding left using thesafe-area-inset-left
valueu-safeArea-r
applies padding right using thesafe-area-inset-right
valueu-safeArea-t
applies padding top using thesafe-area-inset-top
valueu-safeArea-b
applies padding bottom using thesafe-area-inset-bottom
valueu-safeArea-h
combines bothu-safeArea-l
andu-safeArea-r
u-safeArea-v
combines bothu-safeArea-t
andu-safeArea-b
Available in breakpoint format eg. u-mL-4@xs
, u-mL-4@s
, u-mL-4@m
, u-mL-4@l
, u-mL-4@xl
u-mL-a
applies margin left autou-mR-a
applies margin right autou-mT-a
applies margin top autou-mB-a
applies margin bottom autou-mH-a
combines bothu-mL-a
andu-mR-a
u-mV-a
combines bothu-mT-a
andu-mB-a
u-mL-4
applies margin left at the specified size using the rem unitu-mR-4
applies margin right at the specified size using the rem unitu-mT-4
applies margin top at the specified size using the rem unitu-mB-4
applies margin bottom at the specified size using the rem unitu-mH-4
combines bothu-mL-4
andu-mR-4
u-mV-4
combines bothu-mT-4
andu-mB-4
Available in breakpoint format eg. u-pL-4@xs
, u-pL-4@s
, u-pL-4@m
, u-pL-4@l
, u-pL-4@xl
u-pL-4
applies padding left at the specified size using the rem unitu-pR-4
applies padding right at the specified size using the rem unitu-pT-4
applies padding top at the specified size using the rem unitu-pB-4
applies padding bottom at the specified size using the rem unitu-pH-4
combines bothu-pL-4
andu-pR-4
u-pV-4
combines bothu-pT-4
andu-pB-4
Parameter | Type | Default | Description |
---|---|---|---|
$attrs | Map | (padding, margin) | Declares spacing types to create |
$dash | String | '-' | Set the character between the classname and the unit |
$rem | Boolean | true | Toggle for pixels or rem values |
$responsive | Map | (up, only) | Sets the responsive rules for class generation |
$steps | Map | (0, 4, 8, 12, 16, 20, 24, 32, 40, 48) | List of spacing sizes to create |
$directions | Map | (top, bottom, left, right, vertical, horizontal) | List of directions to create |
There are many available text utility classes ready for use in the kit. By default the mixin includes them all but you can cherry pick the ones you actually using. π
First the non-breakpoint classes
u-textBolder
appliesfont-weight: bolder
u-textLighter
appliesfont-weight: lighter
u-textStrong
appliesfont-weight: 600
u-textSuccess
appliescolor: $success
u-textWarn
appliescolor: $warn
u-textError
appliescolor: $error
u-textDisabled
appliescolor: $disabled
u-textLower
appliestext-transform: lowercase
u-textUpper
appliestext-transform: uppercase
u-textCaps
appliestext-transform: capitalize
Available in breakpoint format eg. u-pL-4@xs
, u-pL-4@s
, u-pL-4@m
, u-pL-4@l
, u-pL-4@xl
u-textStart
appliestext-align: start
with a fallback totext-align: left
u-textCenter
appliestext-align: center
u-textEnd
appliestext-align: end
with a fallback totext-align: right
u-textJustify
appliestext-align: justify
u-textGrow
appliesfont-size: 125%
u-texthrink
appliesfont-size: 75%
u-textNowrap
applieswhite-space: nowrap
u-h1
enables the h1 element styling to be applied to any elementu-h2
enables the h2 element styling to be applied to any elementu-h3
enables the h3 element styling to be applied to any elementu-h4
enables the h4 element styling to be applied to any elementu-h5
enables the h5 element styling to be applied to any elementu-h6
enables the h6 element styling to be applied to any elementu-s1
applies a size between h1 and h2u-s2
applies a size between h2 and h3u-s3
applies a size between h3 and h4u-s4
applies a size between h4 and h5u-s5
applies a size between h5 and h6u-s6
applies a size below h6
Parameter | Type | Default | Description |
---|---|---|---|
$responsive | Map | (up, only) | Sets the responsive rules for class generation |
$utilities | Map | ( text-start, text-center, text-end, text-grow, text-shrink, text-bolder, text-lighter, text-strong, text-justify, text-success, text-warn, text-error, text-disabled, text-lower, text-upper, text-caps, text-nowrap ) | Declares the types of classes to create |
Quick access to classes enabling you to hide, show, lock and position all or parts of elements can be found here. By default you get all of these when including the mixin but again you can cherry pick the ones you are actually using.
Available in breakpoint format eg. u-hide@xs
, u-hide@s
, u-hide@m
, u-hide@l
, u-hide@xl
u-hide
appliesdisplay: none
u-block
appliesdisplay: block
u-inblock
appliesdisplay: inline-block
u-locked
appliesoverflow: hidden
u-sticky
appliesposition: sticky
along required properties for the polyfillu-radius
appliesborder-radius: $radius
u-pointerNone
appliespointer-events: none
Parameter | Type | Default | Description |
---|---|---|---|
$responsive | Map | (up, only) | Sets the responsive rules for class generation |
$utilities | Map | ( hide, block, inblock, locked, radius, sticky, pointer ) | Declares the types of classes to create |