Building the Foundation
Consistency in application design relies on important elements such as colors and typography. This page provides a general overview of how to import and utilize the color & typography configuration files of this design system into Lit and Tailwind CSS (React) environments.
1. Cloning the GitHub Repository
Start by obtaining the color and typography configuration files managed by this design system. You can begin by cloning or downloading the repository below and copying only the necessary files.
Repository
2. Example of Applying
When using Tailwind, the basic approach is to merge the CSS files that incorporate the colors and fonts defined in this design system into the CSS files used by Tailwind by incorporating them into the tailwind.config.js
.
export default { content: ["./index.html", "./src/**/*.{js,ts,jsx,tsx}"], theme: { extend: { colors: { black: "var(--basic-black)", silver: "var(--basic-silver)", gray: "var(--basic-gray)", white: "var(--basic-white)", // Additional styles }, fontFamily: { // Additional styles } }, }
@tailwind base;@tailwind components;@tailwind utilities;
:root { --basic-black: #000000; --basic-silver: #c0c0c0; --basic-gray: #808080; --basic-white: #ffffff; /* Additional styles */}
When using Lit, you can simply load CSS files such as my-colors.css
or my-typography.css
directly into your web components.
import { css } from "lit";
export const colorPalette = css` :host { /* basic theme */ --basic-black: #000000; --basic-silver: #c0c0c0; --basic-gray: #808080; --basic-white: #ffffff; // Additional styles }`
import { LitElement, html, css } from 'lit';import { colorPalette } from './path/to/my-colors.css';import { typography } from './path/to/my-typography.css';
export class MyWebComponent extends LitElement { static styles = [ colorPalette, typography, css` --color-black: var(--basic-black); --color-silver: var(--basic-silver); --color-gray: var(--basic-gray); --color-white: var(--basic-white); `, ];
render() { return html` <div class="my-class"> <slot></slot> </div> `; }}customElements.define('my-web-component', MyWebComponent);
3. Future Developments
-
Planned additions for component usage methods In addition to the foundational settings for colors & typography, we plan to add how to use components and sample code in the future. As experience accumulates, more detailed documentation will be provided.
-
Regularly check the official documentation Lit and Tailwind are continuously updated. Refer to the official documentation regularly to incorporate the latest information.
- Obtain files from the GitHub repository
- Set up the Tailwind or Lit environment (refer to official documentation)
- Load the placed files in
tailwind.config.js
or CSS modules - Customize as needed and utilize in your project