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

@maggioli-design-system/styles

Package Overview
Dependencies
Maintainers
2
Versions
89
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@maggioli-design-system/styles

This module contains SCSS and CSS styles used by Maggioli Design System, it also makes available a Tailwind config based on Maggioli design tokens.

  • 14.2.2
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
2.3K
decreased by-49.55%
Maintainers
2
Weekly downloads
 
Created
Source

@maggioli-design-system/styles

These are the CSS and Tailwind styles used by components libraries of Magma Design System to use the palette generated by @maggioli-design-system/design-tokens.

Installation

Install the component via npm by running the following command:

npm i @maggioli-design-system/styles

This package works also with yarn:

yarn add @maggioli-design-system/styles

Integration

CSS

The first part to be included are the design tokens, like color palette and typography, that are used by the components.

Colors with tailwind or web components

If you use tailwind or web components, you need to import rgb format of colors:

import '@maggioli-design-system/styles/dist/css/colors-rgb-tones.css';
import '@maggioli-design-system/styles/dist/css/colors-rgb-status.css';
import '@maggioli-design-system/styles/dist/css/colors-rgb-label.css';
import '@maggioli-design-system/styles/dist/css/colors-rgb-brand.css';

You need to import colors because web components and our tailwind config works with our palette, which are custom properties in rgb format (rr, gg, bb).

If for some reason you need to use colors outside tailwind:

.selector {
  color: rgb(var(--tone-neutral-01));
}
Hex colors

If you need just the hex format of colors, you can import them like this:

import '@maggioli-design-system/styles/dist/css/colors-hex-tones.css';
import '@maggioli-design-system/styles/dist/css/colors-hex-status.css';
import '@maggioli-design-system/styles/dist/css/colors-hex-label.css';
import '@maggioli-design-system/styles/dist/css/colors-hex-brand.css';

Then you can use them like this:

.selector {
  color: var(--tone-neutral-01);
}

Dark mode format

our color palette already supports dark mode, either according to your computer settings, or with manual support:

Manual mode

Just add the dark-mode class to the html tag:

<html class="dark-mode">
OS settings mode

Just add the system-mode class to the html tag:

<html class="system-mode">

There are other practices to handle dark mode, check how tailwind handle dark mode, or how is handled by next-themes.


Tailwindcss config

You can use styles with tailwindcss config, palette colors and the rest of it's Design Tokens. There are various ways to use it, check out tailwindcss documentation.

To extend the default tailwind config:

module.exports = {
  content: [
    './src/**/*.{ts,tsx}',
  ],
  important: false,
  presets: [
    require('@maggioli-design-system/styles'),
  ],
}

Fonts

Use @fontsource fonts, which are up to date with Google fonts, styles used in Magma Design System are:

TypeScript

Importing fonts in TypeScript:


```ts
import '@fontsource/karla/400.css'
import '@fontsource/karla/700.css'
import '@fontsource/merriweather/400.css'
import '@fontsource/merriweather/700.css'
import '@fontsource/roboto-mono/400.css'
import '@fontsource/roboto/500.css'
import '@fontsource/roboto/700.css'
import '@fontsource/roboto/900.css'
CSS

Importing fonts in CSS:

@import '@fontsource/karla/400.css';
@import '@fontsource/karla/700.css';
@import '@fontsource/merriweather/400.css';
@import '@fontsource/merriweather/700.css';
@import '@fontsource/roboto-mono/400.css';
@import '@fontsource/roboto/500.css';
@import '@fontsource/roboto/700.css';
@import '@fontsource/roboto/900.css';

Fontsource supports variable fonts.


Dist folder

The dist folder contains the following files:

FolderForFile name
cssbothglobals.css
cssbothreset.css
cssplain cssbase.css
cssplain csscolors-hex-*.css
cssplain csstypography.css
csstailwind or web componentscolors-rgb-*.css
tailwindtailwindbase.css
tailwindtailwind componentscomponents.css
tailwindtailwind typography componentstypography.css

Keywords

FAQs

Package last updated on 13 Feb 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