These are the base styles that should be in all Data Camp apps. The package currently contains SCSS files that are intended to be imported entirely and a `style-variables.js` that contains the Sass variables as a JS object.
npm install @datacamp/styleguide
Import the core file
dc-core.scss
from node_modules
, then remove imports for local files covered within the style guide.
npm update @datacamp/styleguide
Releases will include instructions for necessary updates. For the time being updates should be implemented by the front-end team.
These are the official colors for DataCamp products. Each is available via a SCSS variable and is exported via JS variables. Hex values are present for a reference, please don't use them in code.
$dc-primary
#3ac
$dc-primary-dark
#263e63
$dc-primary-darker
#14243e
$dc-primary-darkest
#0c1626
$dc-primary-light
#7ecce2
$dc-primary-lighter
#d5eaef
$dc-primary-lightest
#ebf4f7
$dc-secondary
#ffc844
$dc-secondary-light
#fbe28d
currentColor
currentColor
$dc-geyser
#cfdce1
$dc-grey-dark
#3d4251
$dc-grey-light
#d1d3d8
$dc-grey-lighter
#e6eaeb
$dc-grey-oslo
#859094
$dc-grey
#4D5356
$dc-raven
#737a80
$dc-porcelain
#f0f4f5
transparent
transparent
$dc-white-transparent
rgba($dc-white, 0.2)
$dc-white
#fff
$dc-green
#36d57d
$dc-green-light
#a5ecc5
$dc-orange
#ff9400
$dc-orange-dark
#ad662c
$dc-purple
#8468c4
$dc-purple-dark
#5d488c
$dc-purple-light
#a786f3
$dc-red
#fe5c5c
$dc-red-light
#ffb5b5
Use these gradients as a
background-image
in your markup.
$dc-gradient-primary
141deg, #2388b0, #3ac
$dc-gradient-primary-dark
141deg, #20748d, #164d62
$dc-gradient-primary-light
180deg, rgba(#fff, 0), rgba(#3ac, 0.075)
$dc-gradient-secondary
0deg, #ffc844, #fcd86c
$dc-gradient-red-light
180deg, rgba(#fff, 0), rgba(#fe5c5c, 0.075)
$dc-gradient-chambray-cloudburst
268deg, #405f8f, #1c3050
$dc-gradient-puertorico-deyork
32deg, #37bbab, #75c97e
This is a common pattern throughout the apps, where media (usually an image) needs to be aligned with body content. We can use this markup within components to minimize repetition.
<div class="dc-bucket">
<div class="dc-bucket__media">
<img src="http://placehold.it/200/ebf4f7/686f75" alt="" width="100">
</div>
<div class="dc-bucket__content">
<p>Any Content can be used here. The default alignment is <code>flex-start</code> or "top".</p>
</div>
</div>
When content needs to be aligned to the left and right edges of its container, use this markup pattern to contain the content.
<div class="dc-edge-to-edge">
<div class="dc-edge-to-edge__item">
Any content that is left aligned
</div>
<div class="dc-edge-to-edge__item">
Any content that is right aligned
</div>
</div>
Alignment will begin at the $dc-bp-xs
breakpoint.
<div class="dc-edge-to-edge@xs">
<div class="dc-edge-to-edge__item">
Stacked by default, left aligned at <code>$dc-bp-xs</code>
</div>
<div class="dc-edge-to-edge__item">
Stacked by default, right aligned at <code>$dc-bp-xs</code>
</div>
</div>
Alignment will begin at the $dc-bp-sm
breakpoint.
<div class="dc-edge-to-edge@sm">
<div class="dc-edge-to-edge__item">
Stacked by default, left aligned at <code>$dc-bp-sm</code>
</div>
<div class="dc-edge-to-edge__item">
Stacked by default, right aligned at <code>$dc-bp-sm</code>
</div>
</div>
Alignment will begin at the $dc-bp-md
breakpoint.
<div class="dc-edge-to-edge@md">
<div class="dc-edge-to-edge__item">
Stacked by default, left aligned at <code>$dc-bp-md</code>
</div>
<div class="dc-edge-to-edge__item">
Stacked by default, right aligned at <code>$dc-bp-md</code>
</div>
</div>
Alignment will begin at the $dc-bp-lg
breakpoint.
<div class="dc-edge-to-edge@lg">
<div class="dc-edge-to-edge__item">
Stacked by default, left aligned at <code>$dc-bp-lg</code>
</div>
<div class="dc-edge-to-edge__item">
Stacked by default, right aligned at <code>$dc-bp-lg</code>
</div>
</div>
<label class="dc-label">
<span class="dc-label__number">1</span>
First name
</label>
<input class="dc-input--text" type="text" placeholder="Placeholder text">
The most reliable way to disable an element is the disabled
attribute, but we also have a dc-is-disabled
class as backup for when that cannot be done.
The lock icon should use the icon solution within the app and should be hidden/shown based on the item's status. This will vary depending on the tech stack.
<label class="dc-label">
<span class="dc-label__number">1</span>
First name
<span class="dc-icon dc-icon--size-18 dc-icon--grey-oslo dc-icon--flex dc-u-ml-8">
<svg class="dc-icon__svg">
<use xlink:href="/assets/toolkit/images/core-components/icons/svg/symbols.svg#lock" />
</svg>
</span></label>
<input class="dc-input--text" type="text" placeholder="Placeholder text" disabled>
<!-- Hack for space -->
<br /><br />
<label class="dc-label">
<span class="dc-label__number">1</span>
First name
<span class="dc-icon dc-icon--size-18 dc-icon--grey-oslo dc-icon--flex dc-u-ml-8">
<svg class="dc-icon__svg">
<use xlink:href="/assets/toolkit/images/core-components/icons/svg/symbols.svg#lock" />
</svg>
</span></label>
<input class="dc-input--text" type="text" placeholder="Placeholder text" value="Sample Text" disabled>
<!-- Hack for space -->
<br /><br />
<label class="dc-label">
<span class="dc-label__number">1</span>
First name
<span class="dc-icon dc-icon--size-18 dc-icon--grey-oslo dc-icon--flex dc-u-ml-8">
<svg class="dc-icon__svg">
<use xlink:href="/assets/toolkit/images/core-components/icons/svg/symbols.svg#lock" />
</svg>
</span></label>
<input class="dc-input--text dc-is-disabled" type="text" placeholder="Placeholder text">
<div class="dc-input-group">
<span class="dc-input-group__icon">
<span class="dc-icon dc-icon--size-18 dc-icon--white dc-icon--flex">
<svg class="dc-icon__svg">
<use xlink:href="/assets/toolkit/images/core-components/icons/svg/symbols.svg#mail" />
</svg>
</span>
</span>
<input class="dc-input-group__input dc-input--text" type="email" placeholder="Email address">
</div>
This is a replacement of dc-input-combo
, allowing for custom caps to be added to each side of inputs.
modifier | result |
---|---|
.dc-input-combo--start |
Aligns .dc-input-combo__cap to the start of the div |
.dc-input-combo--end |
Aligns .dc-input-combo__cap to the end of the div |
<div class="dc-input-combo dc-input-combo--start">
<div class="dc-input-combo__cap dc-u-fx-center">
<!-- This content can be custom and modifieres of cap can be used for styling -->
<span class="dc-icon dc-icon--size-24 dc-icon--primary dc-icon--flex">
<svg class="dc-icon__svg">
<use xlink:href="/assets/toolkit/images/core-components/icons/svg/symbols.svg#eye" />
</svg>
</span>
</div>
<input class="dc-input--text dc-input-combo__input" placeholder="Placeholder text" type="text">
</div>
<!-- Hack for spacing without adding unrelated classes -->
<br />
<br />
<div class="dc-input-combo dc-input-combo--end">
<input class="dc-input--text dc-input-combo__input" placeholder="Placeholder text" type="text">
<div class="dc-input-combo__cap dc-u-fx-center">
<!-- This content can be custom and modifieres of cap can be used for styling -->
<span class="dc-icon dc-icon--size-24 dc-icon--primary dc-icon--flex">
<svg class="dc-icon__svg">
<use xlink:href="/assets/toolkit/images/core-components/icons/svg/symbols.svg#eye" />
</svg>
</span>
</div>
</div>
<textarea class="dc-textarea" type="text" placeholder="DataCamp is awesome beacause..."></textarea>
The most reliable way to disable an element is the disabled
attribute, but we also have a dc-is-disabled
class as backup for when that cannot be done.
<textarea class="dc-textarea" type="text" placeholder="DataCamp is awesome beacause..." disabled></textarea>
<!-- Hack for space -->
<br /><br />
<textarea class="dc-textarea" type="text" placeholder="DataCamp is awesome beacause..." disabled>Sample text</textarea>
<!-- Hack for space -->
<br /><br />
<textarea class="dc-textarea dc-is-disabled" type="text" placeholder="DataCamp is awesome beacause..."></textarea>
<div class="dc-select-container">
<select class="dc-select">
<option value="" selected>Select a country...</option>
<option>Belgium</option>
<option>USA</option>
<option>France</option>
</select>
</div>
Standalone checkbox, which has multiple modifiers.
<label class="dc-input-checkbox">
<input class="dc-input-checkbox__input" type="checkbox">
<span class="dc-input-checkbox__indicator">
<span class="dc-icon dc-input-checkbox__check">
<svg class="dc-icon__svg">
<use xlink:href="/assets/toolkit/images/core-components/icons/svg/symbols.svg#checkmark" />
</svg>
</span>
</span>
</label>
<div class="dc-has-error">
<label class="dc-input-checkbox">
<input class="dc-input-checkbox__input" type="checkbox">
<span class="dc-input-checkbox__indicator">
<span class="dc-icon dc-input-checkbox__check">
<svg class="dc-icon__svg">
<use xlink:href="/assets/toolkit/images/core-components/icons/svg/symbols.svg#checkmark" />
</svg>
</span>
</span>
</label>
</div>
<label class="dc-input-checkbox ">
<input class="dc-input-checkbox__input" type="checkbox">
<span class="dc-input-checkbox__indicator u-fx-center">
<span class="dc-icon dc-input-checkbox__check">
<svg class="dc-icon__svg">
<use xlink:href="/assets/toolkit/images/core-components/icons/svg/symbols.svg#checkmark" />
</svg>
</span>
</span>
<span class="dc-input-checkbox__text">Checkbox Label</span>
</label>
<div class="dc-has-error">
<label class="dc-input-checkbox">
<input class="dc-input-checkbox__input" type="checkbox">
<span class="dc-input-checkbox__indicator">
<span class="dc-icon dc-input-checkbox__check">
<svg class="dc-icon__svg">
<use xlink:href="/assets/toolkit/images/core-components/icons/svg/symbols.svg#checkmark" />
</svg>
</span>
</span>
<span class="dc-input-checkbox__text">Checkbox Label</span>
</label>
</div>
<table>
<thead>
<th>Type</th>
<th>Default</th>
<th>Error</th>
<th>Disabled</th>
</thead>
<tr>
<td>
Unchecked
</td>
<td>
<label class="dc-input-checkbox">
<input class="dc-input-checkbox__input" type="checkbox">
<span class="dc-input-checkbox__indicator">
<span class="dc-icon dc-input-checkbox__check">
<svg class="dc-icon__svg">
<use xlink:href="/assets/toolkit/images/core-components/icons/svg/symbols.svg#checkmark" />
</svg>
</span>
</span>
</label>
</td>
<td>
<div class="dc-has-error">
<label class="dc-input-checkbox">
<input class="dc-input-checkbox__input" type="checkbox">
<span class="dc-input-checkbox__indicator">
<span class="dc-icon dc-input-checkbox__check">
<svg class="dc-icon__svg">
<use xlink:href="/assets/toolkit/images/core-components/icons/svg/symbols.svg#checkmark" />
</svg>
</span>
</span>
</label>
</div>
</td>
<td>
<label class="dc-input-checkbox">
<input class="dc-input-checkbox__input" type="checkbox" disabled>
<span class="dc-input-checkbox__indicator">
<span class="dc-icon dc-input-checkbox__check">
<svg class="dc-icon__svg">
<use xlink:href="/assets/toolkit/images/core-components/icons/svg/symbols.svg#checkmark" />
</svg>
</span>
</span>
</label>
</td>
<td>
<label class="dc-input-checkbox">
<input class="dc-input-checkbox__input" type="checkbox" disabled checked>
<span class="dc-input-checkbox__indicator">
<span class="dc-icon dc-input-checkbox__check">
<svg class="dc-icon__svg">
<use xlink:href="/assets/toolkit/images/core-components/icons/svg/symbols.svg#checkmark" />
</svg>
</span>
</span>
</label>
</td>
</tr>
<tr>
<td>
With Label
</td>
<td>
<label class="dc-input-checkbox">
<input class="dc-input-checkbox__input" type="checkbox">
<span class="dc-input-checkbox__indicator u-fx-center">
<span class="dc-icon dc-input-checkbox__check">
<svg class="dc-icon__svg">
<use xlink:href="/assets/toolkit/images/core-components/icons/svg/symbols.svg#checkmark" />
</svg>
</span>
</span>
<span class="dc-input-checkbox__text">
Checkbox Label
</span>
</label>
</td>
<td>
<div class="dc-has-error">
<label class="dc-input-checkbox">
<input class="dc-input-checkbox__input" type="checkbox">
<span class="dc-input-checkbox__indicator u-fx-center">
<span class="dc-icon dc-input-checkbox__check">
<svg class="dc-icon__svg">
<use xlink:href="/assets/toolkit/images/core-components/icons/svg/symbols.svg#checkmark" />
</svg>
</span>
</span>
<span class="dc-input-checkbox__text">
Checkbox Label
</span>
</label>
</div>
</td>
<td>
<label class="dc-input-checkbox">
<input class="dc-input-checkbox__input" type="checkbox" disabled>
<span class="dc-input-checkbox__indicator u-fx-center">
<span class="dc-icon dc-input-checkbox__check">
<svg class="dc-icon__svg">
<use xlink:href="/assets/toolkit/images/core-components/icons/svg/symbols.svg#checkmark" />
</svg>
</span>
</span>
<span class="dc-input-checkbox__text">
Checkbox Label
</span>
</label>
</td>
<td>
<label class="dc-input-checkbox">
<input class="dc-input-checkbox__input" type="checkbox" disabled checked>
<span class="dc-input-checkbox__indicator u-fx-center">
<span class="dc-icon dc-input-checkbox__check">
<svg class="dc-icon__svg">
<use xlink:href="/assets/toolkit/images/core-components/icons/svg/symbols.svg#checkmark" />
</svg>
</span>
</span>
<span class="dc-input-checkbox__text">
Checkbox Label
</span>
</label>
</td>
</tr>
</table>
<label class="dc-input-radio">
<input class="dc-input-radio__input" id="radio1" name="radio" type="radio">
<span class="dc-input-radio__indicator u-fx-center"></span>
</label>
<!-- Second radio is to show the toggling -->
<label class="dc-input-radio u-spacing-t1">
<input class="dc-input-radio__input" id="radio2" name="radio" type="radio">
<span class="dc-input-radio__indicator u-fx-center"></span>
</label>
<div class="dc-has-error">
<label class="dc-input-radio">
<input class="dc-input-radio__input" id="radio1" name="radio" type="radio">
<span class="dc-input-radio__indicator u-fx-center"></span>
</label>
</div>
<!-- Second radio is to show the toggling -->
<label class="dc-input-radio u-spacing-t1">
<input class="dc-input-radio__input" id="radio2" name="radio" type="radio">
<span class="dc-input-radio__indicator u-fx-center"></span>
</label>
<label class="dc-input-radio">
<input class="dc-input-radio__input" id="radio1" name="radio" type="radio">
<span class="dc-input-radio__indicator"></span>
<span class="dc-input-radio__text">Radio Label</span>
</label>
<!-- Second radio is to show the toggling -->
<label class="dc-input-radio u-spacing-t1">
<input class="dc-input-radio__input" id="radio2" name="radio" type="radio">
<span class="dc-input-radio__indicator"></span>
<span class="dc-input-radio__text">Radio Label</span>
</label>
<table style="vertical-align: middle;">
<thead>
<th>Type</th>
<th>Default</th>
<th>Error</th>
<th>Disabled</th>
</thead>
<tr>
<td>
No Label
</td>
<td>
<label class="dc-input-radio">
<input class="dc-input-radio__input" id="radio1" name="radio-no-label" type="radio">
<span class="dc-input-radio__indicator"></span>
</label>
</td>
<td>
<div class="dc-has-error">
<label class="dc-input-radio">
<input class="dc-input-radio__input" id="radio2" name="radio-no-label" type="radio">
<span class="dc-input-radio__indicator"></span>
</label>
</div>
</td>
<td>
<label class="dc-input-radio">
<input class="dc-input-radio__input" id="radio3" name="radio-no-label" type="radio" disabled>
<span class="dc-input-radio__indicator"></span>
</label>
</td>
<td>
<label class="dc-input-radio">
<input class="dc-input-radio__input" id="radio4" name="radio-no-label-disabled" type="radio" disabled checked>
<span class="dc-input-radio__indicator"></span>
</label>
</td>
</tr>
<tr>
<td>
With Label
</td>
<td>
<label class="dc-input-radio">
<input class="dc-input-radio__input" id="radio5" name="radio-label" type="radio">
<span class="dc-input-radio__indicator"></span>
<span class="dc-input-radio__text">
Radio Label
</span>
</label>
</td>
<td>
<div class="dc-has-error">
<label class="dc-input-radio">
<input class="dc-input-radio__input" id="radio6" name="radio-label" type="radio">
<span class="dc-input-radio__indicator"></span>
<span class="dc-input-radio__text">
Radio Label
</span>
</label>
</div>
</td>
<td>
<label class="dc-input-radio">
<input class="dc-input-radio__input" id="radio7" name="radio-label-disabled" type="radio" disabled>
<span class="dc-input-radio__indicator"></span>
<span class="dc-input-radio__text">
Radio Label
</span>
</label>
</td>
<td>
<label class="dc-input-radio">
<input class="dc-input-radio__input" id="radio8" name="radio-label" type="radio" disabled checked>
<span class="dc-input-radio__indicator"></span>
<span class="dc-input-radio__text">
Radio Label
</span>
</label>
</td>
</tr>
</table>
<input type="search" placeholder="Search..." class="dc-input-search ">
<div class="dc-toggle-switch">
<span class="dc-toggle-switch__text">Lorem ipsum</span>
<input class="dc-toggle-switch__input" type="checkbox" id="dc-toggle-switch__input">
<label class="dc-toggle-switch__label" for="dc-toggle-switch__input"></label>
</div>
Sample of using Lato font with a font weight (400) for body text and a bold font weight (700) for headings. New sizes and line heights applied.
Variable / Class | Font Size - px | Font-Size - REM | Line Height Multiplier | Line Heigh - px | Font Weight | Letter Spacing |
---|---|---|---|---|---|---|
$dc-font-size-micro |
12px | 0.75rem | 1.5 | 18px | 400 | 0 |
$dc-font-size-small |
14px | 0.875rem | 1.5 | 21px | 400 | 0 |
.dc-chapeau-title |
14px | 0.875rem | 1.5 | 21px | 700 | 2px |
$dc-font-size-base |
16px | 1rem | 1.5 | 24px | 400 | 0 |
$dc-font-size-h6 |
16px | 1rem | 1.25 | 20px | 700 | 0 |
$dc-font-size-h5 |
18px | 1.125rem | 1.25 | 22.5px | 700 | 0 |
$dc-font-size-h4 |
20px | 1.125rem | 1.25 | 25px | 700 | 0 |
$dc-font-size-h3 |
24px | 1.5rem | 1.25 | 30px | 700 | 0 |
$dc-font-size-h2 |
32px | 2rem | 1.25 | 40px | 700 | 0 |
$dc-font-size-h1 |
40px | 2.5rem | 1.25 | 50px | 700 | 0 |
<h3 class="dc-fs-h3">
Course Description
</h3>
<p>
In this introduction to R, you will master the basics of this beautiful open source language, including factors, lists and data frames. With the knowledge gained in this course, you will be ready to undertake your first very own data analysis. With over 2 million users worldwide R is rapidly becoming the leading programming language in statistics and data science. Every year, the number of R users grows by 40% and an increasing number of organizations are using it in their day-to-day activities. Leverage the power of R by completing this free R online course today!
</p>
We use the Lato font with a light font weight (300) for body text and a bold font weight (700) for headings. You can find more information on specific element styles below.
font-size
/ 50px line-height
Use an <h1>
or apply .dc-h1
to another element — add the .dc-u-color-white
class on dark backgrounds.
<h1>Heading 1 40px/50px</h1>
<div class="bg-dark">
<!-- Div is only for context -->
<h1 class="dc-u-color-white">Heading 1</h1>
<!-- Div is only for context -->
</div>
<h5 class="dc-h1">H5 styled as Heading 1</h5>
font-size
/ 40px line-height
Use an <h2>
or apply .dc-h2
to another element — add the .dc-u-color-white
class on dark backgrounds.
<h2>Heading 2</h2>
<div class="bg-dark">
<!-- Div is only for context -->
<h2 class="dc-u-color-white">Heading 2</h2>
<!-- Div is only for context -->
</div>
<h5 class="dc-h2">H5 styled as Heading 2</h5>
font-size
/ 30px line-height
Use an <h3>
or apply .dc-h3
to another element — add the .dc-u-color-white
class on dark backgrounds.
<h3>Heading 3</h3>
<div class="bg-dark">
<!-- Div is only for context -->
<h3 class="dc-u-color-white">Heading 3</h3>
<!-- Div is only for context -->
</div>
<h5 class="dc-h3">H5 styled as Heading 3</h5>
font-size
/ 25px line-height
Use an <h4>
or apply .dc-h4
to another element — add the .dc-u-color-white
class on dark backgrounds.
<h4>Heading 4</h4>
<div class="bg-dark">
<!-- Div is only for context -->
<h4 class="dc-u-color-white">Heading 4</h4>
<!-- Div is only for context -->
</div>
<h5 class="dc-h4">H5 styled as Heading 4</h5>
font-size
/ 22.5px line-height
Use an <h5>
or apply .dc-h2
to another element — add the .dc-u-color-white
class on dark backgrounds.
<h5>Heading 5</h5>
<div class="bg-dark">
<!-- Div is only for context -->
<h5 class="dc-u-color-white">Heading 5</h5>
<!-- Div is only for context -->
</div>
<h1 class="dc-h5">H1 styled as Heading 5</h1>
font-size
/ 20px line-height
Use an <h6>
or apply .dc-h6
to another element — add the .dc-u-color-white
class on dark backgrounds.
<h6>Heading 6</h6>
<div class="bg-dark">
<!-- Div is only for context -->
<h6 class="dc-u-color-white">Heading 6</h6>
<!-- Div is only for context -->
</div>
<h1 class="dc-h6">H1 styled as Heading 6</h1>
font-size
/ 17.5px line-height
/ 2px letter-spacing
Use an <hx>
element and apply the .dc-chapeau-title
class.
<h3 class="dc-chapeau-title">Chapeau title</h3>
font-size
/ 17.5px line-height
/ 2px letter-spacing
Use an <hx>
element and apply the .dc-chapeau
and .dc-chapeau--secondary
classes.
<!-- Div is only for context -->
<div class="bg-dark">
<h3 class="dc-chapeau-title dc-chapeau-title--secondary">Chapeau title secondary</h3>
</div>
<!-- Div is only for context -->
font-size
/ 24px line-height
Default text (paragraphs etc.) — use a utility class of .dc-u-fs-base
or the variable $dc-font-size-base
.
<p>Default text</p>
font-size
/ 21px line-height
Use a utility class of .dc-u-fs-small
or the variable $dc-font-size-small
.
<p class="dc-u-fs-small">Small text</p>
font-size
/ 18px line-height
Use a utility class of .dc-u-fs-micro
or the variable $dc-font-size-micro
.
<p class="dc-u-fs-micro">Micro text</p>
font-size
/ 24px line-height
Use an <a>
element or .dc-link
if you need to make another element look like a link.
<a href="#">Link</a>
font-size
/ 24px line-height
Use an <a>
element with the classes.
<a class="dc-link dc-link--grey" href="#">Link</a>
font-size
/ 24px line-height
Use an <a>
element with the classes.
<a class="dc-link dc-link--grey-dark" href="#">Link</a>
font-size
/ 24px line-height
Use an <a>
element with the classes.
<a class="dc-link dc-link--secondary" href="#">Link</a>
font-size
/ 24px line-height
Use an <a>
element with the classes.
<a class="dc-link dc-link--grey-oslo" href="#">Link</a>
<fieldset class="hr-line">
<legend align="center">OR</legend>
</fieldset>