Skip to content

iotacss/tools.type

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

6 Commits
 
 
 
 
 
 
 
 

Repository files navigation

iotaCSS is now a monorepo and all individual repositories are part of it. Please open issues or PRs here: https://github.com/iotacss/iotacss.

Type Tool

The type tool contains a mixin that helps you create smart, flexible and responsive typography.

Installation

npm install --save iotacss-tools-type

Mixins

@include iota-type($sizes, $breakpoints: $iota-global-breakpoints);

Parameters

  • sizes: number | list | map
  • breakpoints: map of breakpoints, default is $iota-global-breakpoints

Examples

Simple Font Size

Use a number as a parameter to create simple font size.

$type-head-large: 26px;

.h1 {
  @include iota-type($type-head-large);
}

will generate:

.h1 {
  font-size: 26px;
}

Simple Font Size and Line Height

Use a list as a parameter to create simple font size and line-height.

$type-head-large: (26px, 30px);

.h1 {
  @include iota-type($type-head-large);
}

will generate:

.h1 {
  font-size: 26px;
  line-leight: 30px;
}

Responsive Font Size

Use a map as a parameter to create a responsive font-size.

$type-head-large: (
  null: 20px,
  sm: 26px
);

.h1 {
  @include iota-type($type-head-large);
}

will generate:

.h1 {
  font-size: 20px;
}

@media screen and ( min-width: 768px ) {
  .h1 {
    font-size: 26px;
  }
}

Responsive Font Size and Line Height

Use a map of lists as a parameter to create a responsive font-size and line-height.

$type-head-large: (
  null: (20px, 26px),
  sm: (26px, 30px)
);

.h1 {
  @include iota-type($type-head-large);
}

will generate:

.h1 {
  font-size: 20px;
  line-height: 26px;
}

@media screen and ( min-width: 768px ) {
  .h1 {
    font-size: 26px;
    line-height: 30px;
  }
}

Responsive Font Size and Line Height with Custom Breakpoints map

Use a map of lists as a first parameter to create a responsive font-size and line-height and a map of breakpoints as a second, to create responsive typography based on custom set of breakpoints.

$type-head-large: (
  null: (20px, 26px),
  smo: (26px, 30px)
);

$type-breakpoints: (
  smo: screen and ( min-width: 768px and max-width: 999px )
);

.h1 {
  @include iota-type($type-head-large, $type-breakpoints);
}

will generate:

.h1 {
  font-size: 20px;
  line-height: 26px;
}

@media screen and ( min-width: 768px and max-width: 999px ) {
  .h1 {
    font-size: 26px;
    line-height: 30px;
  }
}

About

Type tool for iotaCSS

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages