No Preview

Sorry, but you either have no stories or none are selected somehow.

If the problem persists, check the browser console, or the terminal you've run Storybook from.

The component failed to render properly, likely due to a configuration issue in Storybook. Here are some common causes and how you can address them:

  1. Missing Context/Providers: You can use decorators to supply specific contexts or providers, which are sometimes necessary for components to render correctly. For detailed instructions on using decorators, please visit the Decorators documentation.
  2. Misconfigured Webpack or Vite: Verify that Storybook picks up all necessary settings for loaders, plugins, and other relevant parameters. You can find step-by-step guides for configuring Webpack or Vite with Storybook.
  3. Missing Environment Variables: Your Storybook may require specific environment variables to function as intended. You can set up custom environment variables as outlined in the Environment Variables documentation.

Theme

The Emotion theme for codecademy

All Emotion components we build have access to a typed theme object allowing you to have direct access to all the design tokens without any imports.

These are most easily available through our context and accessed via our gamut-styles utility functions.

import { css } from '@codecademy/gamut-styles'; import styled from '@emotion/styled'; // Single value using static color const Box = styled.div(css({ bg: 'navy-400', p: 4 })); // Multiple values using ColorMode semantic color const OtherCoolThing = styled.div(css({ color: 'primary', p: 4 }));

They can also be accessed directly as the theme prop on every styled component.

import styled from '@emotion/styled'; const styles = styled.div` blue: ${({ theme }) => theme.colors.blue}; `;

Or by importing the object from @codecademy/gamut-styles if you are not using a ThemeProvider in your app.

import { css } from '@emotion/react'; import { theme } from '@codecademy/gamut-styles'; const myStyles = css` font-size: ${theme.fontSize[14]}; `;

Color

Key: theme.colors

All current visual identity colors are available on the colors key on the Theme object, this includes named standard colors and their respective swatches.

Standard colors

Standard color atoms we select from in creating designs. All colors on Codecademy properties should adhere to these. Remember your accessibility contrast requirements too!

Prop
Path
Swatch
beige
theme.colors.beige
#FFF0E5
blue
theme.colors.blue
#1557FF
green
theme.colors.green
#008A27
hyper
theme.colors.hyper
#3A10E5
lightBlue
theme.colors.lightBlue
#66C4FF
lightGreen
theme.colors.lightGreen
#AEE938
navy
theme.colors.navy
#10162F
orange
theme.colors.orange
#FF8C00
paleBlue
theme.colors.paleBlue
#F5FCFF
paleGreen
theme.colors.paleGreen
#F5FFE3
palePink
theme.colors.palePink
#FFF5FF
paleYellow
theme.colors.paleYellow
#FFFAE5
pink
theme.colors.pink
#F966FF
paleRed
theme.colors.paleRed
#DC5879
red
theme.colors.red
#E91C11
yellow
theme.colors.yellow
#FFD300
black
theme.colors.black
#000000
white
theme.colors.white
#ffffff

Solid color swatches

Swatch colors are accessible with a dashcase key theme.colors['${color}-${weight}']. Here's a list of all the solid swatches available.

Prop
Path
Swatch
beige
theme.colors[`beige-100`]
#FFF0E5
blue
theme.colors[`blue-0`]
0#F5FCFF
100#D3F2FF
300#66C4FF
400#3388FF
500#1557FF
800#1D2340
green
theme.colors[`green-0`]
0#F5FFE3
100#EAFDC6
400#AEE938
700#008A27
yellow
theme.colors[`yellow-0`]
0#FFFAE5
400#CCA900
500#FFD300
pink
theme.colors[`pink-0`]
0#FFF5FF
400#F966FF
red
theme.colors[`red-0`]
0#E85D7F
100#DC5879
500#E91C11
600#BE1809
orange
theme.colors[`orange-100`]
100#FFE8CC
500#FF8C00
hyper
theme.colors[`hyper-400`]
400#5533FF
500#3A10E5
gray
theme.colors[`gray-100`]
100#F5F5F5
200#EEEEEE
300#E0E0E0
600#9E9E9E
800#616161
900#424242

With the exception of the weight-100, navy-800, and navy-900 color weights, our navy and white color weights are semi-transparent. Special consideration should be taken when using these colors, especially when overlapping. The white weights, with the non-transparent exceptions, are only visible in dark mode, and the navy weights, with the non-transparent exceptions, are only visible in light mode. You can swap modes using the Color Mode toggle at the top of this screen.

These tokens are also accessible with a dashcase key theme.colors['${color}-${weight}'].

Prop
Path
Swatch
navy
theme.colors[`navy-100`]
100rgba(16,22,47,0.04)
200rgba(16,22,47,0.12)
300rgba(16,22,47,0.28)
400rgba(16,22,47,0.45)
500rgba(16,22,47,0.63)
600rgba(16,22,47,0.75)
700rgba(16,22,47,0.86)
800#10162F
900#0A0D1C
white
theme.colors[`white-100`]
100rgba(255,255,255,0.04)
200rgba(255,255,255,0.09)
300rgba(255,255,255,0.2)
400rgba(255,255,255,0.33)
500rgba(255,255,255,0.5)
600rgba(255,255,255,0.65)
700rgba(255,255,255,0.8)

Color modes

We have 2 core color modes that we support: light and dark.

Each color mode consists of a set of aliased color tokens. Each alias has semantic meaning for how the color is used throughout our design system:

  • text: The standard text color for all type.
  • background: The base background color.
  • primary: The color used for interactive elements with a primary action.
  • secondary: The color used for interactive elements with a secondary action.

For more on Color Modes please checkout the full color mode documentation

Light mode

Prop
Path
Swatch
text
theme.colors.text
var(--color-navy-800)
text-accent
theme.colors.text-accent
var(--color-navy-900)
text-disabled
theme.colors.text-disabled
var(--color-navy-500)
text-secondary
theme.colors.text-secondary
var(--color-navy-600)
feedback-error
theme.colors.feedback-error
var(--color-red-600)
feedback-success
theme.colors.feedback-success
var(--color-green-700)
feedback-warning
theme.colors.feedback-warning
var(--color-yellow)
background
theme.colors.background
var(--color-white)
background-contrast
theme.colors.background-contrast
var(--color-white)
background-current
theme.colors.background-current
var(--color-white)
background-primary
theme.colors.background-primary
var(--color-beige)
background-selected
theme.colors.background-selected
var(--color-navy-100)
background-disabled
theme.colors.background-disabled
var(--color-navy-200)
background-hover
theme.colors.background-hover
var(--color-navy-200)
shadow-primary
theme.colors.shadow-primary
var(--color-navy-800)
shadow-secondary
theme.colors.shadow-secondary
var(--color-navy-600)
primary
theme.colors.primary
var(--color-hyper-500)
primary-hover
theme.colors.primary-hover
var(--color-hyper-400)
primary-inverse
theme.colors.primary-inverse
var(--color-yellow-500)
secondary
theme.colors.secondary
var(--color-navy-800)
secondary-hover
theme.colors.secondary-hover
var(--color-navy-700)
danger
theme.colors.danger
var(--color-red-500)
danger-hover
theme.colors.danger-hover
var(--color-red-600)
interface
theme.colors.interface
var(--color-hyper-500)
interface-hover
theme.colors.interface-hover
var(--color-hyper-400)
border-primary
theme.colors.border-primary
var(--color-navy-800)
border-secondary
theme.colors.border-secondary
var(--color-navy-600)
border-tertiary
theme.colors.border-tertiary
var(--color-navy-300)
border-disabled
theme.colors.border-disabled
var(--color-navy-500)

Example

Dark mode

Prop
Path
Swatch
text
theme.colors.text
var(--color-white)
text-accent
theme.colors.text-accent
var(--color-beige)
text-disabled
theme.colors.text-disabled
var(--color-white-500)
text-secondary
theme.colors.text-secondary
var(--color-white-600)
feedback-error
theme.colors.feedback-error
var(--color-red-0)
feedback-success
theme.colors.feedback-success
var(--color-green-400)
feedback-warning
theme.colors.feedback-warning
var(--color-yellow-0)
background
theme.colors.background
var(--color-navy-800)
background-contrast
theme.colors.background-contrast
var(--color-black)
background-current
theme.colors.background-current
var(--color-navy-800)
background-primary
theme.colors.background-primary
var(--color-navy-900)
background-selected
theme.colors.background-selected
var(--color-white-100)
background-disabled
theme.colors.background-disabled
var(--color-white-200)
background-hover
theme.colors.background-hover
var(--color-white-200)
shadow-primary
theme.colors.shadow-primary
var(--color-white)
shadow-secondary
theme.colors.shadow-secondary
var(--color-white-600)
primary
theme.colors.primary
var(--color-yellow-500)
primary-hover
theme.colors.primary-hover
var(--color-yellow-400)
primary-inverse
theme.colors.primary-inverse
var(--color-hyper-500)
secondary
theme.colors.secondary
var(--color-white)
secondary-hover
theme.colors.secondary-hover
var(--color-white-700)
danger
theme.colors.danger
var(--color-red-0)
danger-hover
theme.colors.danger-hover
var(--color-red-100)
interface
theme.colors.interface
var(--color-yellow-500)
interface-hover
theme.colors.interface-hover
var(--color-yellow-400)
border-primary
theme.colors.border-primary
var(--color-white)
border-secondary
theme.colors.border-secondary
var(--color-white-600)
border-tertiary
theme.colors.border-tertiary
var(--color-white-300)
border-disabled
theme.colors.border-disabled
var(--color-white-500)

Typography

Font family

Key: theme.fontFamily

Prop
Path
Value
Example
accent
theme.fontFamily.accent
"Suisse"
Example Text
base
theme.fontFamily.base
"Apercu"
Example Text
monospace
theme.fontFamily.monospace
Monaco
Example Text
system
theme.fontFamily.system
-apple-system
Example Text

Font size

Key: theme.fontSize

Prop
Path
Value
Example
14
theme.fontSize[14]
0.875rem
Example Text
16
theme.fontSize[16]
1rem
Example Text
18
theme.fontSize[18]
1.125rem
Example Text
20
theme.fontSize[20]
1.25rem
Example Text
22
theme.fontSize[22]
1.375rem
Example Text
26
theme.fontSize[26]
1.625rem
Example Text
34
theme.fontSize[34]
2.125rem
Example Text
44
theme.fontSize[44]
2.75rem
Example Text
64
theme.fontSize[64]
4rem
Example Text

Font weight

Key: theme.fontWeight

Prop
Path
Value
Example
400
theme.fontWeight.400
400
Example Text
700
theme.fontWeight.700
700
Example Text
base
theme.fontWeight.base
400
Example Text
title
theme.fontWeight.title
700
Example Text

Line height

Key: theme.lineHeight

Prop
Path
Value
Example
base
theme.lineHeight[base]
1.5
Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur.
spacedTitle
theme.lineHeight[spacedTitle]
1.3
Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur.
title
theme.lineHeight[title]
1.2
Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur.

Space

Spacing

Key: theme.spacing

Prop
Path
Value
Example
0
theme.spacing[0]
0
4
theme.spacing[4]
0.25rem
8
theme.spacing[8]
0.5rem
12
theme.spacing[12]
0.75rem
16
theme.spacing[16]
1rem
24
theme.spacing[24]
1.5rem
32
theme.spacing[32]
2rem
40
theme.spacing[40]
2.5rem
48
theme.spacing[48]
3rem
64
theme.spacing[64]
4rem
96
theme.spacing[96]
6rem

Layout

Breakpoints

Key: theme.breakpoints

Prop
Path
Value
xs
theme.breakpoints[xs]
@media only screen and (min-width: 480px)
sm
theme.breakpoints[sm]
@media only screen and (min-width: 768px)
md
theme.breakpoints[md]
@media only screen and (min-width: 1024px)
lg
theme.breakpoints[lg]
@media only screen and (min-width: 1200px)
xl
theme.breakpoints[xl]
@media only screen and (min-width: 1440px)

Border Radius

Key: theme.borderRadii

Prop
Path
Value
Example
none
theme.borderRadii.none
0px
sm
theme.borderRadii.sm
2px
md
theme.borderRadii.md
4px
lg
theme.borderRadii.lg
8px
xl
theme.borderRadii.xl
16px
full
theme.borderRadii.full
999px