Traits
Traits provide a collection of utility helper rule sets.
Display
Control display by using the display
trait attribute.
Markup
<div pam-space="p:2" pam-skin="bg:gray:100" pam-size="w:1-2">
<div pam-display="[modifier]" pam-skin="bg:gray:300" pam-space="p:4 mb:px">Display 1</div>
<div pam-display="[modifier]" pam-skin="bg:gray:300" pam-space="p:4 mb:px">Display 2</div>
<div pam-display="[modifier]" pam-skin="bg:gray:300" pam-space="p:4 mb:px">Display 3</div>
</div>
Hooks
.hook-display
Border
Trait to control border properties width
, style
, color
and radius
with the pam-border
attribute.
Width
Control border width. Format pam-border="w:{size}"
.
Markup
<div pam-border="[modifier]" pam-skin="bg:gray:100" pam-size="w:10 h:3">
</div>
Width sides
Control border width for individual sides. Format pam-border="{side}w:{size}"
.
Markup
<div pam-border="[modifier]" pam-skin="bg:gray:100" pam-size="w:10 h:3">
</div>
Border style
Control border style. Format pam-border="{style}"
.
Markup
<div pam-border="w:4 [modifier]" pam-skin="bg:gray:100" pam-size="w:10 h:3">
</div>
Border color
Control the border color with pam-border={skin-colors}
.
Note You always need to declare a border width.
Markup
<div pam-border="w:2 [modifier]" pam-size="w:10 h:3">
</div>
Border radius
Control border radius with pam-border="radius:{type}"
trait.
Markup
<div pam-border="w:2 [modifier]" pam-size="w:10 h:3">
</div>
Hooks
.hook-border
Flex
The flex trait helps with building layouts by utilizing
the css flexbox and the flex specs. It's also used to
control component layouts such as Grid
, Lists
and Menus
.
By default the flex trait is set to display: flex;
. To lay out
inline items and their children as flexboxes use the inline
modifier.
Markup
<div pam-flex="[modifier]" pam-space="p:2" pam-skin="bg:gray:100">
<div pam-skin="bg:gray:300" pam-space="p:4 mr:2">Item 1</div>
<div pam-skin="bg:gray:300" pam-space="p:4 mr:2">Item 2</div>
<div pam-skin="bg:gray:300" pam-space="p:4">Item 3</div>
</div>
Main axis
Control the main axis space and alignment of flex items by using
{ left | right | between | around }
modifiers. Default
behaviour is the sames as left
.
Markup
<div pam-flex="[modifier]" pam-space="p:2" pam-skin="bg:gray:100">
<div pam-skin="bg:gray:300" pam-space="p:4 mr:2">Item 1</div>
<div pam-skin="bg:gray:300" pam-space="p:4 mr:2">Item 2</div>
<div pam-skin="bg:gray:300" pam-space="p:4">Item 3</div>
</div>
Cross axis
Control the cross axis placement of flex items by using
{ bottom | middle | stretch | top }
modifiers.
Default behaviour is the same as stretch
.
Markup
<div pam-flex="[modifier]" pam-space="p:2" pam-skin="bg:gray:100">
<div pam-skin="bg:gray:300" pam-space="p:4 mr:2">
<div pam-typography="body-1">Item 1</div>
<div pam-typography="body-2">More height</div>
<div pam-typography="body-2">than the others.</div>
</div>
<div pam-skin="bg:gray:300" pam-space="p:4 mr:2"> Item 2</div>
<div pam-skin="bg:gray:300" pam-space="p:4 mr:2">Item 3</div>
</div>
Direction
Control the direction the main axis runs in with the
{ row | column }
direction modifiers. By default it's set to row
.
Markup
<div pam-flex="[modifier]" pam-space="p:2" pam-skin="bg:gray:100">
<div pam-skin="bg:gray:300" pam-space="p:4 mr:2 mb:2">Item 1</div>
<div pam-skin="bg:gray:300" pam-space="p:4 mr:2 mb:2">Item 2</div>
<div pam-skin="bg:gray:300" pam-space="p:4 mr:2 mb:2">Item 3</div>
</div>
Wrap
To control if flex items should be forced onto one line or can wrap onto multiple lines. Flex items are fit into one line by default.
Markup
<div pam-flex="[modifier]" pam-space="p:2" pam-skin="bg:gray:100">
<div pam-size="w:1-3" pam-skin="bg:gray:300" pam-space="p:4 mr:2 mb:2">Item 1</div>
<div pam-size="w:1-3" pam-skin="bg:gray:300" pam-space="p:4 mr:2 mb:2">Item 2</div>
<div pam-size="w:1-3" pam-skin="bg:gray:300" pam-space="p:4 mr:2 mb:2">Item 3</div>
<div pam-size="w:1-3" pam-skin="bg:gray:300" pam-space="p:4 mr:2 mb:2">Item 4</div>
<div pam-size="w:1-3" pam-skin="bg:gray:300" pam-space="p:4 mr:2 mb:2">Item 5</div>
<div pam-size="w:1-3" pam-skin="bg:gray:300" pam-space="p:4 mr:2 mb:2">Item 6</div>
</div>
Align content
It aligns multilined flexboxes when there is extra space in the cross-axis, similar to how justify-content aligns items within the main-axis.
Note This property has no effect when the flexbox has only a single line
Markup
<div pam-flex="wrap [modifier]" pam-space="p:2" pam-skin="bg:gray:100" pam-size="h:10">
<div pam-skin="bg:gray:300" pam-space="p:4 mr:2">Item 1</div>
<div pam-skin="bg:gray:300" pam-space="p:4 mr:2">Item 2</div>
<div pam-skin="bg:gray:300" pam-space="p:4 mr:2">Item 3</div>
<div pam-skin="bg:gray:300" pam-space="p:4 mr:2">Item 1</div>
<div pam-skin="bg:gray:300" pam-space="p:4 mr:2">Item 2</div>
<div pam-skin="bg:gray:300" pam-space="p:4 mr:2">Item 3</div>
</div>
Order
Sets the order to lay out an item in a flex or grid container. Items are sorted by ascending order then by their source order.
Markup
<div pam-flex="" pam-space="p:2" pam-skin="bg:gray:100">
<div pam-skin="bg:gray:300" pam-space="p:4 mr:2">Item 1</div>
<div pam-flex-order="[modifier]" pam-skin="bg:gray:300" pam-space="p:4 mr:2">Item 2</div>
<div pam-skin="bg:gray:300" pam-space="p:4 mr:2">Item 3</div>
</div>
Dimension
Control how a flex item grows or shrinks to fit the space available.
By default flex items don't shrink below their minimum content size.
Set a min-width
or min-height
to change this behaviour.
Markup
<div pam-flex="" pam-space="p:2" pam-skin="bg:gray:100">
<div pam-skin="bg:gray:300" pam-space="p:4 mr:2">Item 1</div>
<div pam-flex-dimension="[modifier]" pam-skin="bg:gray:300" pam-space="p:4 mr:2">Item 2</div>
<div pam-skin="bg:gray:300" pam-space="p:4 mr:2">Item 3</div>
</div>
Hooks
.hook-flex
Float
Control floats by using the float
trait attribute.
Markup
<div pam-border="w:px" pam-space="p:2" pam-float="group">
<div pam-float="[modifier]">Floating element</div>
</div>
Hooks
.hook-float
Group
To easily clear floats use the pam-group
attribute to clear the parent element.
Markup
<div pam-group>
<div style="float:left;">Floting element</div>
</div>
Image
Use the pam-image
attribute with a img element to nomalize the image size.
Markup
<img pam-Image src="kss-assets/img/icon-60@3x.png">
Opacity
Trait for controlling element opacity.
1
. In other words it's solid.
Markup
<div pam-opacity="[modifier]" pam-skin="primary" pam-space="p:4" pam-size="w:1-2">
<span pam-skin="on:primary">Opacity [modifier]</span>
</div>
Hooks
.hook-opacity
Overflow
Control how an element handles overflow content with the overflow
trait.
Format {axis}:{type}
.
- axis:
{"" | x | y}
- type:
{auto | hidden | scroll | visible}
Markup
<div pam-overflow="[modifier]" pam-size="h:5" pam-space="p:2" pam-shadow="z2">
<div pam-size="h:10" pam-space="p:2">Lorem ipsum dolor sit amet, consectetur adipiscing elit. Nam lorem ante, elementum eget tortor id, pellentesque lacinia dolor. Nunc in metus facilisis, scelerisque ante eget, lacinia purus. Nam tincidunt arcu sed libero egestas, sit amet pretium felis laoreet. Aenean quis purus suscipit, venenatis nunc vel, fermentum nisi. Nam a metus dictum, sollicitudin ligula a, mollis est. Phasellus consectetur est nec velit interdum dignissim. Nunc enim felis, porta at nisl ultricies, porta molestie nibh. Nam tincidunt arcu sed libero egestas, sit amet pretium felis laoreet. Aenean quis purus suscipit, venenatis nunc vel, fermentum nisi.</div>
</div>
Hooks
.hook-overflow
Position
The position trait sets how an element is positioned in a document.
Combine position type and location properties to position the element. The space
trait
follows the format {type} {location }
.
- type -
{static | relative | absolute | fixed | sticky}
- location -
{top | right | bottom | left | center | cover}
Note To use absolute positioning correctly you need to apply a relative position to the parent element.
Location
The top
, right
, bottom
and left
placement properties sets
the location of positioned elements.
Markup
<div pam-Grid>
<div pam-Unit="2-3">
<img pam-image src="kss-assets/img/photo-position.jpg" alt="Joanna Kosinska">
<div pam-position="absolute top" pam-overlay="light" pam-flex="center">Top</div>
<div pam-position="absolute right" pam-overlay="light" pam-flex="middle">Right</div>
<div pam-position="absolute bottom" pam-overlay="light" pam-flex="center">Bottom</div>
<div pam-position="absolute left" pam-overlay="light" pam-flex="middle">Left</div>
</div>
</div>
Explicit locations
Control location of a element in more detail by using combination
of the format {x}:{y}
that won't spread across the element.
- x -
{left | center | right}
- y -
{top | center | bottom}
Markup
<div pam-Grid>
<div pam-Unit="2-3">
<img pam-image src="kss-assets/img/photo-position.jpg" alt="Joanna Kosinska">
<div pam-position="absolute top:left" pam-overlay="light" pam-flex="center">Top left</div>
<div pam-position="absolute top:center" pam-overlay="light" pam-flex="middle">Top center</div>
<div pam-position="absolute top:right" pam-overlay="light" pam-flex="middle">Top right</div>
<div pam-position="absolute center:left" pam-overlay="light" pam-flex="middle">Center left</div>
<div pam-position="absolute center" pam-overlay="light" pam-flex="middle">Center</div>
<div pam-position="absolute center:right" pam-overlay="light" pam-flex="center">Center right</div>
<div pam-position="absolute bottom:left" pam-overlay="light" pam-flex="middle">Bottom left</div>
<div pam-position="absolute bottom:center" pam-overlay="light" pam-flex="middle">Bottom center</div>
<div pam-position="absolute bottom:right" pam-overlay="light" pam-flex="middle">Bottom right</div>
</div>
</div>
Outside
Position elements outside of the parent element element by using the out
modifier.
Markup
<div pam-Flex="center">
<div pam-size="w:1-2" pam-position="relative">
<img pam-image src="kss-assets/img/photo-position.jpg" alt="Joanna Kosinska">
<div pam-position="absolute center:left out" pam-overlay="dark" pam-flex="middle">Center left</div>
<div pam-position="absolute center:right out" pam-overlay="dark" pam-flex="center">Center right</div>
</div>
</div>
Cover
To make a position element cover its parent element use the cover
location poperty.
Markup
<div pam-Grid>
<div pam-Unit="2-3">
<img pam-image src="kss-assets/img/photo-position.jpg" alt="Joanna Kosinska">
<div pam-position="absolute cover" pam-overlay="light" pam-flex="center middle">Cover</div>
</div>
</div>
Shadow
Add shadow elevation to an element with the shadow
trait. Format z{number}
,
where numbers is 0-24
.
Markup
<div pam-shadow="[modifier]" pam-space="p:4" pam-size="w:1-3 h:3"></div>
Hooks
.hook-shadow
Size
Control element dimensions width
, min-width
, max-width
, height
, min-height
, max-height
which follows the format pam-size="{type}
:{size | fractions}
".
- selector:
pam-size
, - type:
w = width
|h = height
- size:
0-20
|full
|auto
|viewport
- fractions:
@fractions = 1, 2, 3, 4, 5, 6
Auto Width
Set width to auto with w:auto
.
Markup
<div pam-size="w:auto" pam-space="p:2" pam-skin="bg:gray:200">Width auto</div>
Viewport Width
Set width to cover the enitre width of the viewport with w:viewport
.
Markup
<div pam-space="pb:4" pam-overflow="auto">
<div pam-size="w:viewport h:1" pam-skin="bg:gray:200"></div>
</div>
Fixed Width
Set a fixed width with w:{ number }px
. These are exact pixel widths
which covers multiples of four up to 12px.
Markup
<div pam-size="[modifier] h:1" pam-skin="bg:gray:200"></div>
Fixed multiplier width
Set a fixed width with w:{ number }
. With the range 0-20
and the multiplier for number
is 16.
Markup
<div pam-size="[modifier] h:1" pam-skin="bg:gray:200"></div>
Fraction Width
To set percentage based width use w:{ fraction }
or w:full
.
By default supported fractions are 1, 2, 3, 4, 5, 6
.
Markup
<div pam-flex pam-skin="primary:light">
<div pam-size="[modifier] h:2" pam-text="center" pam-skin="primary on:primary">
</div>
</div>
Responsive Width
To set percentage based width use w:{ fraction }
or w:full
.
By default supported fractions are 1, 2, 3, 4, 5, 6
.
Tip Adjust the window width to see the widths change.
Markup
<div pam-flex pam-skin="primary:light">
<div pam-size="w:full [modifier] h:2" pam-text="center" pam-skin="primary on:primary">
</div>
</div>
Min-Width
Control minimum width with min-w:0
or min-w:full
.
Markup
<div pam-space="p:4" pam-skin="bg:gray:100">
<div pam-size="min-w:full" pam-skin="bg:gray:300" pam-space="p:4">
Min width full
</div>
</div>
Max-Width
To set max-width of an element use max-w:{ size }
. Default supported max
width sizes are the screen width sizes.
Markup
<div pam-size="[modifier] h:1" pam-skin="bg:gray:200"></div>
Auto Height
Set height to auto with w:auto
.
Markup
<div pam-size="h:auto w:10" pam-space="p:4" pam-skin="bg:gray:200">Height auto</div>
Viewport Height
Set height to viewport height with w:viewport
.
Markup
<div pam-size="h:viewport" pam-skin="bg:gray:200"></div>
Fixed height
Set a fixed height with h:{ number }px
. These are exact pixel heights
which covers multiples of four up to 12px.
Markup
<div pam-size="[modifier] w:2" pam-skin="bg:gray:200"></div>
Fixed multiplier height
Set a fixed height with h:{ number | px }
. Multiplier for number
is 16.
Markup
<div pam-size="[modifier] w:2" pam-skin="bg:gray:200"></div>
Full Height
Set height to 100% of parent element with w:full
.
Markup
<div pam-size="h:15">
<div pam-size="h:full w:5" pam-skin="bg:gray:200"></div>
</div>
Min-Height
Control minimum height with min-h:0
, min-h:full
and min-h:viewport
.
Markup
<div pam-size="h:10" pam-space="p:4" pam-skin="bg:gray:100">
<div pam-size="min-h:full" pam-flex="center middle" pam-skin="bg:gray:300" pam-space="p:4">
Min height full
</div>
</div>
Max-Height
Control maximum height with max-h:full
or max-h:viewport
.
Markup
<div pam-size="h:4" pam-space="p:4" pam-skin="bg:gray:100">
<div pam-size="max-h:full" pam-flex="center middle" pam-skin="bg:gray:300" pam-space="p:4">
Max height full
</div>
</div>
Hooks
.hook-size
Space
Control margin and padding with the space
trait which
follows the format {type}{side}:{size}
- type -
{p = padding | m = margin}
, - side -
{t = top | r = right | b = bottom | l = left}
- size -
{0-8, multiplier is 4}
Special cases:
- side -
{x = left and right | y = top and bottom}
- size -
{ auto = set margin to auto }
<!-- SPACING ON ALL SIDES (p = padding, m = margin) -->
<div pam-space="p">Padding on all sides</div>
<!-- SPACING ON TWO SIDES (x = lef and right, y = top and bottom) -->
<div pam-space="px">Padding on left and right side</div>
<!-- SPACING ON ONE SIDE (t = top, r = right, b = bottom, l = left) -->
<div pam-space="pt">Padding on the top side</div>
<!-- SPACING SIZE ({0-8}, multiplier of 4) -->
<div pam-space="p:0">Padding 0 on all sides</div>
<div pam-space="p:2">Size 2 padding on all sides</div>
<div pam-space="pl:2">Size 2 padding on left side</div>
<!-- AUTO -->
<div pam-space="m:auto">Margin auto on left and right side</div>
<!-- NONE -->
<div pam-space="none">Margin 0 and Padding 0 on all sides</div>
<div pam-space="m:0">Margin 0 on left and right side</div>
Hooks
.hook-space
Text
Trait for controlling element text properties. such as alignment
,
decoration
and transform
.
Align
Trait for controlling element text alignment.
Text
Text
Text
Text
Text
Markup
<p pam-text="[modifier]">Text</p>
Decoration
Controls for text decoration.
Some interesting text.
Some interesting text.
Some interesting text.
Some interesting text.
Markup
<p pam-text="[modifier]">Some interesting text.</p>
Transform
Controls for element text transform.
some cool text.
some cool text.
some cool text.
some cool text.
some cool text.
Markup
<p pam-text="[modifier]">some cool text.</p>
Hooks
.hook-text
Visibility
To control the visibility of an element. Use pam-{visible | invisible}
for
visibility and pam-hidden
to hide an element that takes up no space.
You can also use the shorthand for these properties which are
visible
| invisible
and hidden
.
Markup
<div pam-Grid pam-Grid-Control="space-x">
<div pam-Unit="1-2 medium:1-3">
<div pam-visibile pam-Alert="simple">
Visible
</div>
</div>
<div pam-Unit="1-2 medium:1-3">
<div pam-Alert="simple success">Invisible</div>
<div pam-invisible pam-Alert="simple" pam-position="absolute cover" pam-space="m:0">
Not Invisible
</div>
</div>
<div pam-Unit="1-2 medium:1-3">
<div pam-Alert="simple success">Hidden</div>
<div pam-hidden pam-Alert="simple" pam-position="absolute cover" pam-space="m:0">
Not Hidden
</div>
</div>
</div>
Hide
To hide a element at a specific screen size use
the hide
trait. It uses the format {size}:{direction}
.
- size -
{ sm | md | lg | xl }
- direction -
{ "" | up | down }
<div pam-hide="{size}">Affects device widths that's in the size range</div>
<div pam-hide="{size}:{direction}">Affects device widths below or over the declared size</div>
Tip Adjust the window width to see the hiding in action.
Markup
<div pam-flex="wrap">
<div pam-hide="[modifier]" pam-size="w:full md:w:1-5">
<div pam-skin="bg:gray:200" pam-space="p:4">
<span>Small</span>
</div>
</div>
</div>
Touch
Use the pam-hide="touch"
and pam-hide="no:touch"
to hide a element
on a touch device or a none touch device.
Markup
<div pam-Grid pam-Grid-Control="space-x">
<div pam-Unit="1-2 medium:1-3">
<div pam-Alert="simple success">Hidden Touch</div>
<div pam-hide="touch" pam-Alert="simple" pam-position="absolute cover" pam-space="m:0">Hidden Touch</div>
</div>
<div pam-Unit="1-2 medium:1-3">
<div pam-Alert="simple success">Hidden No Touch</div>
<div pam-hide="no:touch" pam-Alert="simple" pam-position="absolute cover" pam-space="m:0">Hidden No Touch</div>
</div>
</div>
Z-Index
Trait for controlling element z-index.
Format: pam-z="{number}
", supported numbers
are 0-24.
Markup
<div pam-position="relative">
<div pam-z="0" pam-size="w:7 h:7" pam-space="mb:6" pam-skin="bg:gray:200"></div>
<div pam-z="1" pam-position="absolute top" pam-size="w:7 h:7" pam-space="ml:2 mt:2" pam-skin="bg:gray:400"></div>
<div pam-z="2" pam-position="absolute top" pam-size="w:7 h:7" pam-space="ml:4 mt:4" pam-skin="bg:gray:600"></div>
<div pam-z="3" pam-position="absolute top" pam-size="w:7 h:7" pam-space="ml:6 mt:6" pam-skin="bg:gray:800"></div>
</div>
Hooks
.hook-z