Cozy-UI Styleguide

Cozy-UI Styleguide

1.1 Breakpoints

This is the collection of available breakpoint variables:

  • BP-teeny - 375px
  • BP-tiny - 480px
  • BP-small - 768px
  • BP-medium - 1023px
  • BP-large - 1200px
  • BP-extra-large - 1439px


Also we have a standard breakpoints collection meant to be used as suffixes for some utility classes

If you want a utility class to trigger only at defined breakpoints you can use those:

  • -t - refers to tiny breakpoint (max-width: 480px)
  • -s - refers to small breakpoint (max-width: 768px)
  • -m - refers to medium breakpoint (max-width: 1023px)

1.1.1 Media Queries mixins

You can use these mixins with no arguments and they will output the desired a max-width media-query. Use the direction argument to set it to min.

1.1.1.8 medium-device()

Refers to (min-width: 543px) and (min-height: 375px) Triggers when the viewport has a width bigger than 543px AND a height bigger than 375px

1.1.1.9 small-device()

Refers to (max-width: 543px), (max-height: 375px) Triggers when the viewport has a width smaller than 543px OR a height smaller than 375px

1.2 Colors

Colors used in the user interface.

ℹ️ In general, you are advised to use theme colors when building your components: this will ensure your components react correctly when changing the theme.

If you need to access an absolute color that is not semantic, you can use

import palette from 'cozy-ui/transpiled/react/palette'
<div style={{ backgroundColor: palette.melon }} />

1.2.1 Blue

Parameters:
  • Stylus: zircon
    #F5FAFF, CSS: var(--zircon)
  • Stylus: dodgerBlue
    #297EF2, CSS: var(--dodgerBlue)
  • Stylus: scienceBlue
    #0B61D6, CSS: var(--scienceBlue)

1.2.2 Green

Parameters:
  • Stylus: weirdGreen
    #40DE8E, CSS: var(--weirdGreen)
  • Stylus: emerald
    #35CE68, CSS: var(--emerald)
  • Stylus: malachite
    #08b442, CSS: var(--malachite)

1.2.3 Grey

Parameters:
  • Stylus: grey0
    #FFFFFF, CSS: var(--grey0)
  • Stylus: grey50
    #f9fafb, CSS: var(--grey50)
  • Stylus: grey100
    #f4f5f6, CSS: var(--grey100)
  • Stylus: grey200
    #eceff1, CSS: var(--grey200)
  • Stylus: grey300
    #dde0e3, CSS: var(--grey300)
  • Stylus: grey400
    #bfc3c7, CSS: var(--grey400)
  • Stylus: grey500
    #9da2a6, CSS: var(--grey500)
  • Stylus: grey600
    #7c8086, CSS: var(--grey600)
  • Stylus: grey700
    #5d6169, CSS: var(--grey700)
  • Stylus: grey800
    #3e424a, CSS: var(--grey800)
  • Stylus: grey900
    #1d212a, CSS: var(--grey900)
  • Stylus: greyA100
    #d3d6d8, CSS: var(--greyA100)
  • Stylus: greyA200
    #a7abaf, CSS: var(--greyA200)
  • Stylus: greyA400
    #2c3039, CSS: var(--greyA400)
  • Stylus: greyA700
    #5d6169, CSS: var(--greyA700)
  • Stylus: white
    #FFFFFF, CSS: var(--white)
  • Stylus: paleGrey
    #F5F6F7, CSS: var(--paleGrey)
  • Stylus: silver
    #D6D8Da, CSS: var(--silver)
  • Stylus: coolGrey
    #95999D, CSS: var(--coolGrey)
  • Stylus: slateGrey
    #5D6165, CSS: var(--slateGrey)
  • Stylus: charcoalGrey
    #32363F, CSS: var(--charcoalGrey)
  • Stylus: black
    #000000, CSS: var(--black)

1.2.5 Red

Parameters:
  • Stylus: chablis
    #FFF2F2, CSS: var(--chablis)
  • Stylus: yourPink
    #FDCBCB, CSS: var(--yourPink)
  • Stylus: fuchsia
    #FC4C83, CSS: var(--fuchsia)
  • Stylus: pomegranate
    #F52D2D, CSS: var(--pomegranate)
  • Stylus: monza
    #DD0505, CSS: var(--monza)

1.3 Font Stack

There's only one font available, Lato, which is used on body, so basically everywhere. It's also available in bold.

Example

This is basic text

And this is bold text

<p>This is basic text</p>
<p><strong>And this is bold text</strong></p>

1.4 Icons

Icons system management.

Use them by extending the placebolders like this @extend $icon-16

1.4.1 Icon sizes

There are several preset squared sizes available. Sizes are set using rem unit and their equivalents in px matches if the default size of your page is 16px (which is the default size in Cozy-UI)

Parameters:
  • $icon-8
    Equivalent to 8px
  • $icon-12
    Equivalent to 12px
  • $icon-16
    Equivalent to 16px
  • $icon-24
    Equivalent to 24px
  • $icon-36
    Equivalent to 36px
  • $icon-80
    Equivalent to 80px

1.4.2 Icon options

Some available options for icon elements.

Parameters:
  • $icon-centered
    Element is vertically & horizontally centered
  • $spin-anim
    Element spins endlessly on itself

1.5 Theme

Semantic colors suitable for theming. We encourage users of cozy-ui to use semantic colors instead of absolute colors to facilitate theming.

We try to use a naming schema that is close to what is use in Material-UI React's theming. It is possible that we have some discrepancies. If you see something that seems out of the ordinary and where you think we could reduce the difference with MUI, please do not hesitate to open an issue.

1.5.1 Action colors

These colors use the alpha layer. Be careful to use the semantic variable. Hexadecimal colors are here only as an example on a white background.

Parameters:
  • Stylus: actionColorActive
    #8A8C90, CSS: var(--actionColorActive)
  • Stylus: actionColorHover
    #F7F7F7, CSS: var(--actionColorHover)
  • Stylus: actionColorSelected
    #EFEFF0, CSS: var(--actionColorSelected)
  • Stylus: actionColorDisabled
    #CFCFD1, CSS: var(--actionColorDisabled)
  • Stylus: actionColorDisabledBackground
    #E7E7E8, CSS: var(--actionColorDisabledBackground)
  • Stylus: actionColorFocus
    #E7E7E8, CSS: var(--actionColorFocus)
  • Stylus: actionColorGhost
    #EFEFF0, CSS: var(--actionColorGhost)
  • Stylus: actionColorHoverGhost
    #DFE0E0, CSS: var(--actionColorHoverGhost)

1.5.2 Background colors

Parameters:
  • Stylus: primaryBackgroundLight
    #F7FAFF, CSS: var(--primaryBackgroundLight)
  • Stylus: paperBackgroundColor
    #FFF, CSS: var(--paperBackgroundColor)
  • Stylus: defaultBackgroundColor
    #F4F5F6, CSS: var(--defaultBackgroundColor)
  • Stylus: contrastBackgroundColor
    #F5F5F6, CSS: var(--contrastBackgroundColor)

1.5.3 Border colors

These colors use the alpha layer. Be careful to use the semantic variable. Hexadecimal colors are here only as an example on a white background.

Parameters:
  • Stylus: borderMainColor
    #DFE0E0, CSS: var(--borderMainColor)
  • Stylus: borderDisabledColor
    #EFEFF0, CSS: var(--borderDisabledColor)
  • Stylus: borderGhostColor
    #9D9EA1, CSS: var(--borderGhostColor)
  • Stylus: borderGhostDisabledColor
    #DFE0E0, CSS: var(--borderGhostDisabledColor)

1.5.4 Divider colors

These colors use the alpha layer. Be careful to use the semantic variable. Hexadecimal colors are here only as an example on a white background.

Parameters:
  • Stylus: dividerColor
    #E3E4E5, CSS: var(--dividerColor)

1.5.5 Error colors

Parameters:
  • Stylus: errorColorLightest
    #FFECEC, CSS: var(--errorColorLightest)
  • Stylus: errorColorLight
    #F96B6B, CSS: var(--errorColorLight)
  • Stylus: errorColor
    #EA3F3F, CSS: var(--errorColor)
  • Stylus: errorColorDark
    #D31F1F, CSS: var(--errorColorDark)
  • Stylus: errorBackground
    #FFECEC, CSS: var(--errorBackground)
  • Stylus: errorColorContrastText
    #FFF, CSS: var(--errorColorContrastText)

1.5.6 Info colors

Parameters:
  • Stylus: infoColorLight
    #0EC4C7, CSS: var(--infoColorLight)
  • Stylus: infoColor
    #009FA2, CSS: var(--infoColor)
  • Stylus: infoColorDark
    #007578, CSS: var(--infoColorDark)
  • Stylus: infoColorContrastText
    #FFF, CSS: var(--infoColorContrastText)

1.5.7 Primary colors

Parameters:
  • Stylus: primaryColorLightest
    #B3D3FF, CSS: var(--primaryColorLightest)
  • Stylus: primaryColorLight
    #5C9DF5, CSS: var(--primaryColorLight)
  • Stylus: primaryColor
    #297EF2, CSS: var(--primaryColor)
  • Stylus: primaryColorDark
    #0B61D6, CSS: var(--primaryColorDark)
  • Stylus: primaryContrastTextColor
    #FFF, CSS: var(--primaryContrastTextColor)

1.5.8 Secondary colors

Parameters:
  • Stylus: secondaryColorLightest
    #DDE0E3, CSS: var(--secondaryColorLightest)
  • Stylus: secondaryColorLight
    #9DA2A6, CSS: var(--secondaryColorLight)
  • Stylus: secondaryColor
    #7C8086, CSS: var(--secondaryColor)
  • Stylus: secondaryColorDark
    #5D6169, CSS: var(--secondaryColorDark)
  • Stylus: secondaryContrastTextColor
    #FFF, CSS: var(--secondaryContrastTextColor)

1.5.9 Success colors

Parameters:
  • Stylus: successColorLight
    #38C949, CSS: var(--successColorLight)
  • Stylus: successColor
    #09AB1B, CSS: var(--successColor)
  • Stylus: successColorDark
    #018711, CSS: var(--successColorDark)
  • Stylus: successColorContrastText
    #FFF, CSS: var(--successColorContrastText)

1.5.10 Text colors

These colors use the alpha layer. Be careful to use the semantic variable. Hexadecimal colors are here only as an example on a white background.

Parameters:
  • Stylus: primaryTextColor
    #383B43, CSS: var(--primaryTextColor)
  • Stylus: secondaryTextColor
    #6F7177, CSS: var(--secondaryTextColor)
  • Stylus: disabledTextColor
    #BEBFC1, CSS: var(--disabledTextColor)
  • Stylus: hintTextColor
    #BEBFC1, CSS: var(--hintTextColor)
  • Stylus: iconTextColor
    #66686D, CSS: var(--iconTextColor)

1.5.11 Warning colors

Parameters:
  • Stylus: warningColorLight
    #EFA82F, CSS: var(--warningColorLight)
  • Stylus: warningColor
    #CB8100, CSS: var(--warningColor)
  • Stylus: warningColorDark
    #986100, CSS: var(--warningColorDark)
  • Stylus: warningColorContrastText
    #FFF, CSS: var(--warningColorContrastText)

1.6 Z-Index

List of every z-index related to components in order to keep a clean & maintainable order of indexes.

Those indexes are 10 based so you can deal with extra layers using $index + 1

Parameters:
  • $below-index
    index -1 Layer below the app, mostly for hiding purpose
  • $app-index
    index 0 App index, the ground zero.
  • $low-index
    index 1 Low level index, to make sure a positionned element goes over elements with z-index 0.
  • $alert-index-mobile
    index 10 Alert index like success, errors, infos mobile only
  • $nav-index
    index 20 Nav index
  • $bar-index
    index 21 Bar index equals Nav index + 1, not actually used, just as reference.
  • $selection-index
    index 30 Selection bar index, with actions for selected items
  • $popover-index
    index 40 Popover index used by dropdown menu for example
  • $overlay
    index 50 Overlay index for modals background
  • $file-action-menu
    index 60 File action menu index mobile only
  • $modal-index
    index 70 Modal index
  • $modal-footer-index
    index 71 Modal footer index
  • $modal-toolbar-index
    index 72 Modal toolbar index
  • $alert-index
    index 80 Alert index such as success, errors, infos