6.1.7 • Published 4 years ago

@chrishumboldt/rocket-propel v6.1.7

Weekly downloads
-
License
Apache-2.0
Repository
github
Last release
4 years ago

Propel

A lightweight SASS mixin library and responsive CSS layout engine.

Table of Contents

Getting Started

You can either download a copy of the source files or install via NPM.

npm install rocket-propel

SASS Implementation

Start by importing the necessary file into your own SASS file and include the required mixins.

SASS

@import "rocket-propel/build/sass/import";

.example {
   @include row();

   .left, .middle, .right {
      @include span(12); // 100% width
   }
   @include breakpoint($bpLarge) {
      .left {
         @include span-new(6); // 50% width
      }
      .middle {
         @include span-new(4); // 33.33% width
      }
      .right {
         @include span-new(2); // 16.66% width
      }
   }
}

HTML

<div class="example">
   <div class="left"></div>
   <div class="middle"></div>
   <div class="right"></div>
</div>

Browser Prefixes

Propel will apply all the necessary browser prefixes where needed but no longer supports the -o- prefix for older versions of Opera. Opera now uses the Blink engine from Chromium (Read More).

Find the other available mixins below:

Variables

Propel comes pre-packaged with a host of SASS variables. They are all listed below.

VariableDefault
$columnLimit12
$fontFamily'Open Sans', Helvetica, Arial, sans-serif
$limitWidth68.750em
Breakpoints
VariableValueEvaluates To
$bpSmall21.875em350px
$bpMedium46.875em700px
$bpLarge68.750em1100px
Colours
TypeVariables
Mono$black $blackBase $greyX2Light $greyXLight $greyLight $grey $greyDark $greyXDark $greyX2Dark
Primary$aqua $blue $green $orange $pink $purple $red $yellow
Secondary$asbestos $asphalt $bondiBlue $cloud $concrete $greyBlueXLight $greyBlueLight $greyBlue $greyBlueDark $greyBlueXDark $midnight $offWhite $offWhiteDark $riverBed $silver
Spacing
VariableValue
$spaceBase24px
$spaceSmall12px
$spaceMedium48px
$spaceLarge72px
Text
VariableValue
$georgiaGeorgia, Cambria, "Times New Roman", Times, serif
$helvetica"Helvetica Neue", Helvetica, Arial, sans-serif
$impactImpact, Charcoal, sans-serif
$lato'Lato', sans-serif
$lucindaGrande"Lucida Grande", Tahoma, Verdana, Arial, sans-serif
$monospaceMenlo, "Bitstream Vera Sans Mono", "DejaVu Sans Mono", Monaco, Consolas, monospace
$openSans'Open Sans', Helvetica, Arial, sans-serif
$roboto'Roboto', 'Helvetic Neue', Helvetica, Arial
$tahomaTahoma, Geneva, sans-serif
$timesNewRoman"Times New Roman", Times, serif
$trebuchet"Trebuchet MS", Helvetica, sans-serif
$verdanaVerdana, Geneva, sans-serif
Text Size

The size evaluates to an em value and then down to a pixel value.

VariableEvaluates To
$sizeSmall14px
$sizeBase16px
$sizeMedium18px
$sizeLarge24px
Text Weight
VariableValue
$weightThin100
$weightLight300
$weightBase400
$weightBold700
$weightHeavy900

Animation

MixinDefaultsDescription
animate(attr, speed)speed: 0.2sSet the transition style of attribute attr.
animate-none()Remove all transition styles for an element.
animate-timing-function(timing)Set the transition timing function for an element.
animation(n, dur, i, dir, f)dur: 0.4si: falsedir: falsef: falseSet all the animation properties.n = namedur = durationi = iterationdir = directionf = fill mode
animation-delay(x)Set the animation delay property to x.
animation-direction(x)x: normalSet the animation direction property.
animation-duration(x)Set the animation duration property to x.
animation-fill-mode(x)x: forwardsSet the animation fill mode property.
animation-iteration(x)Set the animation iteration x property.
animation-name(x)Set the animation name property.
animation-timing-function(x)x: ease-outSet the animation timing function property.
keyframes(x)Generate the animation keyframes with name x.
// Animate block on hover
.block {
   @include position(absolute, top 10px left 10px);
   @include height(50px);
   @include width(50px);
   @include background-colour($red);
   @include animate('all', 1s); // Here we attach the animation styles

   &:hover {
      @include position-set(top 20px left 20px);
   }
}

Arrow

MixinDefaultsDescription
arrow(pos, clr, size)pos: bottomclr: $whitesize: 20pxAttach a CSS arrow to an element.
arrow-colour(pos, clr)pos: bottomclr: $whiteChange the colour of an elements CSS arrow.
arrow-none(clr)clr: $whiteRemove an elements CSS arrowReset the background colour.

Background

MixinDefaultsDescription
background-attachment(x)x: scrollSet the background attachment property to x.
background-clip(x)x: border-boxSet the background clip property to x.
background-colour(x)Set the background colour to x.
background-contain()Set the background size to contain and center position.
background-cover()Set the background size to cover and center position.
background-origin(x)x: padding-boxSet the background origin property to x.
background-position(x)x: centerSet the background position property to x.
background-repeat(x)x: repeatSet the background repeat property to x.
background-size(x)x: autoSet the background size property to x.
background-single()Set the background position to centerStop the background from repeating.

Background Images

MixinDefaultsDescription
background-image(url, pos)pos: top leftSet the background image on an element.
background-image-contain(url, pos)pos: centerSet a contained background image on an element.
background-image-cover(url, pos)pos: centerSet a covered background image on an element.
background-image-parallax(url)Set a parallax style background image on an element.
background-image-single(url, pos)pos: centerSet a single background image on an element.
// Set the background
.my-element {
   @include background-image-cover("global/background.png");
}

Borders

Set the border property of an element.

MixinDefaults
border(clr, size, type)clr: $greysize: 1pxtype: solid
border-[s](clr, size, type)[s]: t r b lclr: $greysize: 1pxtype: solid
border-horizontal(clr, size, type)clr: $greysize: 1pxtype: solid
border-vertical(clr, size, type)clr: $greysize: 1pxtype: solid
border-none()
.my-element {
   @include border-left($red, 2px);
}

Border Radius

Set the border radius property on an element.

MixinOptions & Defaults
border-radius(x)x: 2px
border-radius-[s](x)[s]: t r b l tl tr bl brx: 2px
border-radius-none()
.my-element {
   @include border-radius-tr(4px); // This add a border radius to the top right corner.
}

Display

MixinDefaultsDescription
hide()Hide an element.
hide-visually()Hide an element but still make it accessible to the DOM.Used for instances where accessibility is needed.
show(x)x: blockShow an element with display type of x.
opacity(int)int: 0.60Set the opacity of an element.
overflow(x, direction)x: visibledirection: falseSet the overflow of an element.direction is optional and can be vertical or horizontal.
perspective(x)x: 0pxSet the perspective of an element.
transparency(int)int: 0.60Set the transparency of an element.You can also use the opacity mixin as an alternative.
visibility(x)x: visibleSet the visibility property of an element.

Drop Shadow

MixinDefaultsDescription
drop-shadow(clr, size, v, h)clr: fade-out(#000, 0.6)size: 3pxv: 0pxh: 0pxSet the drop shadow of an element.v is the vertical offset.h is the horizontal offset.
drop-shadow-inset(clr, size, v, h)clr: fade-out(#000, 0.6)size: 3pxv: 0pxh: 0pxSet an inset drop shadow of an element.v is the vertical offset.h is the horizontal offset.
drop-shadow-none()Remove any drop shadow.
.my-element {
   @include drop-shadow($green);
}

Global Setup

MixinDescription
global-setup()Apply the border-box property to all elements to contain dimensions. Set the default colour to a lighter, more readable black, the background colour to white and the default font to Open Sans with an Arial and Helvetica fallback. Note that this setup is automatically called by Rocket already.

Gradient

Note that the arguments x and y are the starting and ending gradient colours.

MixinDefaultsDescription
gradient-animate(x, y, angle)angle: 135degApply animated background gradient.
gradient-animate-horizontal(x, y)Apply animated background gradient from left to right.
gradient-animate-vertical(x, y)Apply animated background gradient from top to bottom.
gradient-animate-none()Remove any animated background gradient.
gradient-angle(x, y, angle)angle: -45degApply background gradient.
gradient-horizontal(x, y)Apply background gradient from left to right.
gradient-vertical(x, y)Apply background gradient from top to bottom.
gradient-none()Remove any background gradient.

Interaction

MixinDefaultsDescription
cursor(x)x: autoSet the cursor to x.

iOS

MixinDescription
ios-render()Set some special properties like Webkit's backface visibility and perspective property to help with rendering elements like images.

Layout

MixinDefaultsDescription
box-sizing(x)x: content-boxSet the box sizing style of an element.
center()Center an element within its container.
center-vertical()Center an element vertically within its container.
clearfix()Clear the zoom and set the clear style to both for the element.
level(int)int: 1Set the z-index of an element to int.You can also use the z-index mixin as an alternative.
vertical-align(x)Set the vertical alignment of an element to x.
z-index(int)x: 1Set the z-index of an element to x.

Layout Flex

For information on flex visit CSS-Tricks: A Guide to Flexbox

MixinDefaultsDescription
align-content(x)x: flex-startSet the align content property of a flex element. x can be flex-start, flex-end, center,space-between, space-around or stretch.
align-items(x)x: flex-startSet the align items property of a flex element. x can be flex-start, flex-end, center,space-between, space-around or stretch.
align-self(x)x: autoSet the align self property of a flex element. x can be flex-start, flex-end, center,space-between, space-around or stretch.
flex(grow, shrink, basis)grow: 0shrink: 1basis: autoSet the all the flex properties for a flex item.
flex-basis(x)basis: autoSet the flex basis property for a flex item.
flex-direction(x)x: rowSet the flex direction property of a flex element.x can be row, row-reverse, column or column-reverse.
flex-display(x)x: normalSet the flex display property of a flex element.
flex-flow(x, y)Set the flex direction and wrap properties of a flex element.x is direction.y is wrap.
flex-grow(x)x: 0Set the flex grow property of a flex element.
flex-shrink(x)x: 1Set the flex shrink property of a flex element.
flex-wrap(x)x: nowrapSet the flex wrap property of a flex element.x can be nowrap, wrap or wrap-reverse.
justify-content(x)x: flex-startSet the justify content property of a flex element.x can be flex-start, flex-end, center,space-between or space-around.
order(int)int: 0Set the flex order property for a flex item.

Layout Floats

MixinDescription
float(x)Set the float of an element to x.
float-clear()Clear the float of an element.
float-none()Set the float of an element to none.

Layout Responsive

MixinDefaultsDescription
breakpoint(x, y, z)y: falsez: falseGenerate a media query based on a Rocket preset or a value.x: large, small or an em/px value.y: Breakpoint type of min or maxz: breakpoint orientation.
breakpoint-vertical(x, y, z)y: falsez: falseThe same as breakpoint except it activates vertically.
limit(x)x: $limitWidthAssigns a maximum width to an element and centers it.Anything below the limit will become fluid.Used mainly to contain row elements.
offset(x, y)y: $columnLimitPush an element out x amount of columns from the left.
offset-right(x, y)y: $columnLimitPush an element x amount of columns from the right.
row()Turns an element into a row.Row is needed to wrap any span elements.A row element will default to a 100% width of its container.
span(x, y)y: $columnLimitSpan an element x amount of columns within the z total.See and example below.
span-new(x, y)y: $columnLimitApply a new span amount of x to an element.
<div class="container">
   <div class="left">Left Column</div>
   <div class="right">Right Column</div>
</div>
.container {
   @include row();

   .left,
   .right {
      @include span(12); // Span of 12 is a width of 100% (12/12).
   }

   // Change the layout at the large breakpoint
   @include breakpoint ($bpLarge) {
      .left {
         @include span-new(3); // Span of 3 is a width of 25% (3/12).
      }
      .right {
         @include span-new(9); // Span of 9 is a width of 75% (9/12).
      }
   }
}

List

MixinDefaultsDescription
list-style(x)x: disc outside noneSet the list style.
list-style-image(url)Set the list style image.
list-style-position(x)x: outsideSet the list style position.
list-style-type(x)x: discSet the list style type.

Position

MixinDefaultsDescription
position(x, opt)x: relativeSet the position of an element to x.opt is optional.opt can include top, right, bottom, left,margin-top, margin-right, margin-bottom and margin-left.
position-set(opt)opt can include top, right, bottom, left,margin-top, margin-right, margin-bottom and margin-left.
.my-element {
   @include position(relative, left 10px margin-top 10px)
}

Size

MixinDefaultsDescription
height(x, y, z)x: 0pxy: falsez: falseSet the height of an element.y is the height max.z is the height min.
height-max(x)x: 0pxSet the maximum height of an element.
height-min(x)x: 0pxSet the minimum height of an element.
size(x, y)x: 0pxy: 0pxSet the width x and height y of an element.
square(x)Set the width, height and line-height of an element to x.Center the text.
width(x, y, z)x: 0pxy: falsez: falseSet the width of an element.y is the width max.z is the width min.
width-max(x)x: 0pxSet the maximum width of an element.
width-min(x)x: 0pxSet the minimum width of an element.

Spacing Margins

MixinDefaultsDescription
margin(x)x: 24pxSet all the margins of an element.
margin-[s](x)x: 24pxSet the margin side of s of an element.s can be top, right, bottom, left, horizontal, vertical.
margin-none()Set the margin of an element to 0.
.my-element {
   @include margin-b(12px);
}

Spacing Padding

MixinDefaultsDescription
padding(x)x: 24pxSet all the padding of an element.
padding-[s](x)x: 24pxSet the padding side of s of an element.s can be top, right, bottom, left, horizontal, vertical.
padding-none()Set the padding of an element to 0.
.my-element {
   @include padding-right(20px);
}

Spacing Remove

MixinDescription
spacing-none()Remove all margins and padding from an element.

Text

MixinDefaultsDescription
text-align(x)x: leftSet the text alignment of an element.
text-colour(x)x: $whiteSet the text colour of an element.
text-decoration(x)x: noneSet the text decoration of an element.
text-ellipsis()Set text overflow to ellipsis and prevent word wrapping.
text-font(x)x: $helveticaSet the text font family of an element.
text-hide()Hide the text within an element.
text-letter-spacing(x)x: normalSet the text letter spacing of an element.
text-line-height(x)x: 16pxSet the line height of an element in pixels.Calculates an additional rem overwrite.
text-size(x)x: 16pxSet the font size of an element in pixels.Calculates an additional rem overwrite.
text-style()x: normalSet the text style of an element to $style.
text-transform(x)x: noneSet the text transform property of an element to x.x can be none, capitalize, uppercase,lowercase or initial.
text-weight(x)x: normalSet the text weight of an element to x.

Transform

MixinDefaultsDescription
transform(x)Set the transform of property x for an element.
transform-origin(x, y, z)x: 50%y: 50%z: 0Set the transform origin of an element.
transform-rotate(x)x: 0degSet the transform rotate style of an element.
transform-rotate-x(x)x: 0degSet the transform rotate X style of an element.
transform-rotate-y(x)x: 0degSet the transform rotate Y style of an element.
transform-rotate-z(x)x: 0degSet the transform rotate Z style of an element.
transform-scale(x, y)x: 1y: 1Set the transform scale style of an element.
transform-scale-3d(x, y, z)x: 1y: 1z: 1Set the transform scale3D style of an element.
transform-translate-3d(x, y, z)x: 0pxy: 0pxz: 0pxSet the transform translate3d style of an element.
transform-translate-x(x)x: 1Set the transform translateX style of an element.
transform-translate-y(x)x: 1Set the transform translateY style of an element.
transform-translate-z(x)x: 1Set the transform translateZ style of an element.
transform-easing(x, y, z, s)x: 0pxy: 0pxz: 0pxs: 0.2sAnimate the translate3d transform style (ease-out).

CSS Implementation

Start by including the necessary files.

<head>
   <link href="rocket-propel/css/propel.min.css" rel="stylesheet" type="text/css">
</head>

Alternatively you can also build the SASS out if you wish to include all your CSS in one production file. See an example below.

@import "rocket-propel/build/sass/import";
@include rocket-propel-css;

Now class your HTML to manage your layout. For example:

<div class="_row">
   <div class="_span-2">Span 2</div>
   <div class="_span-2">Span 2</div>
   <div class="_span-2">Span 2</div>
   <div class="_span-2">Span 2</div>
   <div class="_span-2">Span 2</div>
   <div class="_span-2">Span 2</div>
</div>

Classes as Modifiers

Because all classes are declared on the DOM elements themselves, Propel sees them as global modifiers and such uses the _ prefix to reflect this. In the case of modules the module name would prefix the modifier but that only happens with extensions to Rocket Propel.

Find the other available classes below:

Background

ClassOptionsDescription
._back-pos-[x][x]: top, right, bottom, left, centerSet the background position of an element.[x] is for top, right, bottom, left or center.
._back-repeat-[x][x]: no y xSet the background repeat of an element.[x] is for repeat no, along the Y axis or along the X axis.
._back-singleSet the background of element to no repeat and centered.
._back-containSet the background of element to no repeat and contain.
._back-coverSet the background of element to no repeat and cover.
._back-blackSet the background colour to black.
._back-greySet the background colour to medium grey.
._back-grey-lightSet the background colour to light grey.
._back-whiteSet the background colour to white.

Display

ClassOptionsDescription
._hideHide an element.
._hide-visuallyHide an element visually.It will still register as on the page.
._hide-largeHide an element in large view only.
._hide-smallHide an element in small view only.
._showShow an element.
._show-largeShow an element in large view only.
._show-smallShow an element in small view only.
._transparency-[x][x]: 100 75 50 25 0Set the opacity of an element.[x] is for 100%, 75%, 50%, 25% or 0%.

Global

ClassOptions
._propelApply some global styles to the HTML element of your page.

Layout

ClassOptionsDescription
._centerCenter an element.
._float-[x][x]: l rSet the float property of an element to left or right.
._float-noneRemove the float property from an element.
._float-clearStop all floating elements from affecting any element following.
._valign-[x][x]: t m bSet the vertical alignment of an element to top, middle or bottom.
<div class="_center">
   <div class="_float-r">One</div>
   <div class="_float-r">Two</div>
</div>

Layout Responsive

ClassOptionsDescription
._rowSet the element to a row. Used on responsive containers
._span-[i][i]: 1 to 12Set width of an element within a row. The spans are base 12.
._span-large-[i][i]: 1 to 12Set width of an element within a row at the large breakpoint.
._span-small-[i][i]: 1 to 12Set width of an element within a row at the small breakpoint.
._limitLimit an elements width to 68.750em (default) and center.
._offset-[i][i]: 1 to 12Offset from the left by span [i]. The spans are base 12.
._offset-right-[i][i]: 1 to 12Offset from the right by span [i].
._offset-large-[i][i]: 1 to 12Offset from the left by span [i] at the large breakpoint.
._offset-large-right-[i][i]: 1 to 12Offset from the right by span [i] at the large breakpoint.
._offset-small-[i][i]: 1 to 12Offset from the left by span of [i] at the small breakpoint.
._offset-small-right-[i][i]: 1 to 12Offset from the right by span of [i] at the small breakpoint.
<div class="_row">
<div class="_span-12 _span-large-3">Left Column</div>
<div class="_span-12 _span-large-9">Right Column</div>
</div>

Position

ClassDescription
._pos-absoluteSet the position of an element to absolute.
._pos-relativeSet the position of an element to relative.
._pos-staticSet the position of an element to static.
._pos-fixedSet the position of an element to fixed.

Sizing

ClassOptionsDescription
._block-height-[x][x]: 10 20 50 100 200 500 1000Set the height of an element.[x] results in px value.
._block-width-[x][x]: 10 20 50 100 200 500 1000Set the width of an element.[x] results in px value.
<div class="_block-width-10 _block-height-20">Block</div>

Spacing

ClassOptionsDescription
._mgn-[x][x]: 1 to 10Add [x] amount of margin all around.
._mgn-[s]-[x][s]: t r b l[x]: 1 to 10Add [x] amount of margin to the [s] side of an element.
._mgn-noneRemove all margins from an element.
._pad-[x][x]: 1 to 10Add [x] amount of padding all around.
._pad-[s]-[x][s]: t r b l[x]: 1 to 10Add [x] amount of padding to the [s] side of an element.
._pad-noneRemove all padding from an element.
._spacing-noneRemove all padding and margins from an element.
<div class="_pad-t-10">Padding top of 10 pixels</div>
<div class="_mgn-right-10">Margin right of 8 pixels</div>

Text

ClassOptionsDescription
._txt-hideHide the text within an element.
._txt-[x][x]: l c rSet the text alignment to [x].[x] is for left, center, right.
._txt-size-[x][x]: s m n lSet the font size to [x].
._txt-weight-[x][x]: xl l n b xbSet the font weight to [x].
._txt-lightSet the font weight to light.
._txt-boldSet the font weight to bold.
._txt-normalSet the font weight and style to normal.
._txt-italicsSet the font style to italics.
._txt-obliqueSet the font style to oblique.
._txt-whiteSet the font colour to white.
._txt-greySet the font colour to medium grey.
<div class="_txt-weight-xl">Very light text.</div>
<div class="_txt-r">Text aligned right.</div>

Author

Created and maintained by Chris Humboldt Website: chrishumboldt.com Twitter: twitter.com/chrishumboldt GitHub github.com/chrishumboldt

Copyright and License

Copyright 2019 Rocket Project

Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.

6.1.7

4 years ago

6.1.5

4 years ago

6.0.4

4 years ago

6.1.4

4 years ago

6.1.3

4 years ago

6.1.0

4 years ago

6.1.2

4 years ago

6.1.1

4 years ago

6.0.2

4 years ago

6.0.1

4 years ago

6.0.0

4 years ago

5.0.3

5 years ago

5.0.2

5 years ago

5.0.1

5 years ago

5.0.0

5 years ago