Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@coopdigital/foundations

Package Overview
Dependencies
Maintainers
0
Versions
18
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@coopdigital/foundations

Our foundations are the base CSS and variables that we build our products on

  • 1.8.0
  • latest
  • Source
  • npm
  • Socket score

Version published
Maintainers
0
Created
Source

Co-op Foundations

Our foundations are the design basics that we build our products on.

We use foundations to help create our elements and components. When we keep our foundations consistent, our products look and feel consistent for customers.

Structure and contents

The foundations are a mix of baseline CSS styles, fonts, custom properties and utility classes. We have split them into the following categories:

  • Base
  • Colors
  • Layout
  • Spacing
  • Typography
  • UI

Usage

Installation

npm install @coopdigital/foundations
@import "@coopdigital/foundations/dist/vars/vars.css";
@import "@coopdigital/foundations/dist/foundations.css";

This is the easiest way to get everything you need.

Importing partials

If you only require partials of the foundations you can use the imports below. Make sure you keep the structure to ensure the cascade works.

/* Variables */
/* Colours */
@import "@coopdigital/foundations/dist/vars/colors.css";
@import "@coopdigital/foundations/dist/vars/colors-cls.css";
@import "@coopdigital/foundations/dist/vars/colors-membership.css";
/* Typography */
@import "@coopdigital/foundations/dist/vars/typography.css";
/* Spacing */
@import "@coopdigital/foundations/dist/vars/spacing.css";
/* UI */
@import "@coopdigital/foundations/dist/vars/ui.css";

/* Base */
@import "@coopdigital/foundations/dist/base/base.css";
/* Typography */
@import "@coopdigital/foundations/dist/typography/typography.css";
/* Layout */
@import "@coopdigital/foundations/dist/layout/grid.pcss";
/* UI */
@import "@coopdigital/foundations/dist/ui/a11y.css";
@import "@coopdigital/foundations/dist/ui/logo.css";
@import "@coopdigital/foundations/dist/ui/icons.css";

/* Utilities */
@import "@coopdigital/foundations/dist/colors/colors-utilities.css";
@import "@coopdigital/foundations/dist/colors/cls/colors-utilities-cls.css";
@import "@coopdigital/foundations/dist/colors/membership/colors-utilities-membership.css";
@import "@coopdigital/foundations/dist/typography/typography-utilities.css";
@import "@coopdigital/foundations/dist/spacing/spacing-utilities.css";
@import "@coopdigital/foundations/dist/layout/layout-utilities.css";

Icon usage

Icons are separted out as separate SVG files in src and combined in the build script into an SVG sprite called coop-icon-sprite.svg.

This sprite can be served into your project from node_nodules from within foundations/dist/assets/icons/coop-icon-sprite.svg, using the build process of your choice.

Go to the design guidelines on using the icons on the Experience Library icons page

Using the icons in your project

Once you have the icons loaded in your front-end you can referrence them by using:

<svg>
  <use xlink:href="coop-icon-sprite.svg#[icon-file-name]"></use>
</svg>

For example the shopping basket icon would be used with:

Using the icons accessibily

You should always try to pair an icon with text if possible as suggested in the Experience Library guidelines on icons

If the icon is paired with text it is classed as decorative and can be hidden from screenreaders.

<p>
  <svg aria-hidden="“true”">
    <title>Basket</title>
    <use xlink:href="coop-icon-sprite.svg#icon-basket"></use>
  </svg>
  Basket
</p>

If it is not possible to pair the icon with text then the aria-hidden attribute is not needed.

<svg role="img">
  <title>Basket</title>
  <use xlink:href="coop-icon-sprite.svg#icon-basket"></use>
</svg>

CSS

There are some CSS classes to space and size the icons. The scooter being rectangular takes a modifier class to double the width.

.coop-i {
    fill: currentColor;
    margin: 20px;
    width: 32px;
    height: 32px;
}

.coop-i--scooter {
    width: 64px;
}

Full list of icons by ID

#icon-add
#icon-minus
#icon-arrow-up
#icon-arrow-down
#icon-arrow-left
#icon-arrow-right
#icon-chevron-up
#icon-chevron-down
#icon-chevron-left
#icon-chevron-right
#icon-avatar
#icon-avatar-alt
#icon-basket
#icon-clock
#icon-close
#icon-close-alt
#icon-coop
#icon-coop-card
#icon-location
#icon-coop-location
#icon-download
#icon-home
#icon-information
#icon-mail
#icon-menu
#icon-message
#icon-open-new
#icon-phone
#icon-question
#icon-search
#icon-settings
#icon-tick
#icon-tick-alt
#icon-van
#icon-warning
#icon-write
#icon-pencil
#icon-calendar
#icon-scooter

Contributing

Migration from css-foundations to foundations

See our migration guide here

FAQs

Package last updated on 05 Sep 2024

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

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