New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

@bolt/settings-font-size

Package Overview
Dependencies
Maintainers
1
Versions
59
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@bolt/settings-font-size - npm Package Compare versions

Comparing version 0.5.0 to 0.6.0-alpha.8056e857

_settings.font-size.scss

12

package.json

@@ -9,5 +9,6 @@ {

"design system",
"typography"
"typography",
"modular scale"
],
"version": "0.5.0",
"version": "0.6.0-alpha.8056e857",
"maintainers": [

@@ -29,3 +30,3 @@ {

"type": "git",
"url": "https://github.com/bolt-design-system/bolt/tree/master/packages/settings-font-size"
"url": "https://github.com/bolt-design-system/bolt/tree/master/packages/bolt-toolkit-core/settings/settings-font-size"
},

@@ -35,7 +36,6 @@ "bugs": {

},
"style": "index.scss",
"style": "_settings.font-size.scss",
"publishConfig": {
"access": "public"
},
"private": false
}
}

@@ -1,55 +0,153 @@

# @bolt/settings-font-size
Standardized font sizes in Bolt.
# bolt/settings-font-sizes
Fluid, font size settings based on a typographic modular scale. Part of the Bolt “Core” CSS framework that powers the [Bolt Design System](https://www.boltdesignsystem.com).
- [Sass Docs](https://www.boltdesignsystem.com/docs/#settings: font-size)
- [Sassdocs](https://www.boltdesignsystem.com/docs/#settings:%20typography-variable-font-sizes)
- Demo (Coming Soon)
## Install
```bash
npm install @bolt/settings-font-size --save
- - - -
## Table of Contents
- [Cheat Sheet](#cheat-sheet)
- [Getting Started](#getting-started)
- [Font Size Features](#font-size-features)
- [Further Reading](#further-reading)
## Cheat Sheet
### Install via NPM
```
npm install @bolt/settings-font-sizes
```
## Basic usage
```scss
@import 'node_modules/@bolt/settings-font-size';
### Font Sizing Chart*
| Name | Font Size (rems) | Min to max font size (px) | Line Height |
| :------------- | :----------------------: | :---------------------------: | ----------------: |
| xxxlarge** | `2.28rem` to `3.08rem` | `34.20px to 55.44px` |`1.14`|
| xxlarge | `1.78rem` | `26.70px to 32.04px` | `1.13` |
| xlarge | `1.42rem` | `21.30px to 25.56px` | `1.21` |
| large | `1.11rem` | `16.65px to 19.98px` | `1.31` |
| medium (base) | `1.00rem` | `15.00px to 18.00px` | `1.65` |
| small | `0.90rem` | `13.50px to 16.20px` | `1.51` |
| xsmall | `0.80rem` | `12.00px to 14.40px` | `1.45` |
**Sizes Rounded to 2 decimal places*
***In addition to scaling according to base, `xxxlarge` has another scaling that takes care of devices with narrow screen.*
#### Base font size range
`15px` (min) to `18px` (max)
#### To calculate font size in pixels:
`Pixel font size = font size (in rems) × responsive font size base`
#### To calculate line-height n pixels:
`Pixel line-height = font size in px × unitless line height`
> **[Deprecation Notice]:** Coming in from PegaKit? Take note that Bolt’s t-shirt based font size no longer include a `base` font size in order to standardize how we name things across the board. As a rule of thumb, what was once the default `base` font size is now `medium` and any other sizes medium or larger would need to increase by one shirt size.
- - - -
## Getting Started
The best way to start using Bolt is via the *Bolt Starterkit* (coming soon), a pre-assembled front-end boilerplate designed to get you up and running as quickly as possible.
You can also use the full [Bolt Core](https://www.npmjs.com/package/@bolt/core) CSS framework on its own, or, install just the parts you need and fold the different ITCSS layers of Bolt into your existing codebase.
Installing Bolt’s font-size settings is as easy as running NPM install:
```
npm install @bolt/settings-font-sizes
```
<!--
## Usage with [node-sass-magic-importer](https://github.com/maoberlehner/node-sass-magic-importer)
Using [node-sass](https://github.com/sass/node-sass) (or a plugin for Grunt, gulp or webpack which is using node-sass) in combination with the [node-sass-magic-importer](https://github.com/maoberlehner/node-sass-magic-importer) custom importer, can make importing CSS dependencies from `node_modules` a much nicer experience.
> **TIP:**: Don’t have a `package.json` file? Need a little help getting started? Check out our [Getting Started](https://www.boltdesignsystem.com/getting-started) guide for some tips to help get you up to speed.
```scss
// Import the main file.
@import '~@avalanche/setting-font-sizes';
### Usage
Once installed, you should `@import` the main Sass partial into your project’s main `.scss` file to make the included variables available to the rest of your code.
```
// Settings
@import ‘@bolt/settings-font-sizes’
...
## Usage
```scss
// Function.
.selector {
font-size: setting-font-size(m);
}
// Tools
@import ‘@bolt/tools-...’
```
// Map.
.selector {
font-size: map-get($font-sizes, m);
}
Since Bolt's CSS architecture is based on [ITCSS (Inverted Triangle CSS)](http://www.creativebloq.com/web-design/manage-large-css-projects-itcss-101517528)<sup>[1](#1-learn-more-about-itcss)</sup>, what Sass partials you import, and in what order, makes a whole world of difference. That’s why importing any Settings packages from Bolt in your project’s Settings layer (prior to any Sass mixins, resets, base HTML element styles, etc) is so important.
### Compiling
We recommend using Bolt’s Gulp-based [front-end build tools](https://www.npmjs.com/package/@bolt/build-tools) to compile your Sass as we're pre-packaging many of the latest tools and add-ons to help you write your very best: LibSass, Autoprefixer, PostCSS, CleanCSS, Sassdoc, Stylelint, Gulp Plumber, npm-sass, and BrowserSync live reloading.
- - - -
## Font Size Features
The *Bolt Design System* team has gone through vigorous testing to make sure all types are legible on all devices. We have created the following range of sizes to be used for headings and body text. All font sizes are responsive in relation to device screen size.
### **Font Sizes Defined as rems vs px** <sup>[2](#2-rems-for-font-sizes)</sup>
Bolt’s font sizes are defined in rems and and are organized in a structured Sass Map for consistency and maintainability.
> Rem “represents the font-size of the root element (e.g., the font-size of the <html> element). When used within the root elements font-size, it represents its initial value (common browser default is 16px, but changes based upon users preferences).”
> -- [<length> - CSS | MDN](https://developer.mozilla.org/en/docs/Web/CSS/length)
### Line heights Included <sup>[3](#3-unitless-line-heights)</sup>
Each font size includes two pre-defined `unitless` line-heights: the default `regular` line-height for more editorial-focused designs and a `tight` shorter line height option for more interface-focused designs.
### Responsive Ready <sup>[4](#4-fluid-typography--modular-scale)</sup>
By defining our font sizes in REMs and by using unit-less line-heights, Bolt’s font sizes are responsive-ready out of the box. This responsive fluid typographic behavior is automatically included in the separate `bolt/elements-page` package (which gets @imported in the ITCSS elements layer)
```
/*------------------------------------*\
HTML + BODY ELEMENTS
\*------------------------------------*/
/**
* 1. Sets minimum base font size
* 2. Automatic responsive typopgraphy via viewport units
* 3. Sets maximum base font size
*/
html {
font-size: $bolt-font-size--min-px; /* [1] */
## Settings
```scss
/// Default font sizes.
/// @type Map
$font-sizes: (
xs: 0.64em,
s: 0.8em,
m: 1em,
l: 1.25em,
xl: 1.563em,
xxl: 1.953em,
xxxl: 2.441em,
) !default;
@include respond-to(medium) {
font-size: calc(#{$font-size--min-px} + (#{$font-size--max - $font-size--min} * (100vw - #{$breakpoint--min}) / #{strip-unit($breakpoint--max) - strip-unit($breakpoint--min)})); /* [2] */
}
@include respond-to(xlarge) {
font-size: $font-size--max-px; /* [3] */
}
}
```
-->
### License
MIT
### Defined as T-shirt Sizes <sup>[5](#5-naming-things-using-t-shirt)</sup>
As with most sizing options in Bolt, font sizes are categorized and referenced as `t-shirt` sizes, with `medium` being the default base font size (ie. the font size on the <body> or <html> tag), with each t-shirt size option being one step larger/smaller in the typographic modular scale.
## Further Reading:
<h3 id="learn-about-itcss">1. Learn more about ITCSS</h3>
- [Harry Roberts - Managing CSS Projects with ITCSS - YouTube](https://www.youtube.com/watch?v=1OKZOV-iLj4)
- [ITCSS: Scalable and Maintainable CSS Architecture - Xfive](https://www.xfive.co/blog/itcss-scalable-maintainable-css-architecture/)
- [Manage large CSS projects with ITCSS | Creative Bloq](http://www.creativebloq.com/web-design/manage-large-css-projects-itcss-101517528)
- [How I Shrank my CSS by 84kb by Refactoring with ITCSS](https://medium.com/@jordankoschei/how-i-shrank-my-css-by-84kb-by-refactoring-with-itcss-2e8dafee123a)
<h3 id="font-size-rems">2. Rems for Font Sizes</h3>
- [There’s more to the CSS rem unit than font sizing | CSS-Tricks](https://css-tricks.com/theres-more-to-the-css-rem-unit-than-font-sizing/)
- [Font Size Idea: px at the Root, rem for Components, em for Text Elements | CSS-Tricks](https://css-tricks.com/rems-ems/)
- [Guide: EM vs REM vs PX. Which should you use? | Engage](http://engageinteractive.co.uk/blog/em-vs-rem-vs-px)
<h3 id="line-heights-included">3. Unitless Line Heights</h3>
- [line-height | CSS-Tricks](https://css-tricks.com/almanac/properties/l/line-height/#article-header-id-0)
- [Nope, nope, nope, line-height is unitless · Matt Smith](http://allthingssmitty.com/2017/01/30/nope-nope-nope-line-height-is-unitless/)
<h3 id="fluid-typography-modular-scale">4. Fluid typography / modular scale</h3>
- [Fluid Responsive Typography With CSS Poly Fluid Sizing – Smashing Magazine](https://www.smashingmagazine.com/2017/05/fluid-responsive-typography-css-poly-fluid-sizing/)
- [Responsive Typography with Sass Maps](https://www.smashingmagazine.com/2015/06/responsive-typography-with-sass-maps/#organizing-font-sizes-with-sass-maps)
- [GitHub - modularscale/modularscale-sass: Modular scale calculator built into your Sass](https://github.com/modularscale/modularscale-sass)
<h3 id="naming-things-using-t-shirt-sizes">5. Naming things using t-shirt</h3>
- [Space in Design Systems – EightShapes – Medium](https://medium.com/eightshapes-llc/space-in-design-systems-188bcbae0d62)
SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc