Giter VIP home page Giter VIP logo

npm-ui-component-library's Introduction

Newfold Digital UI Component Library

A React component library for building user interfaces. Please visit this resource for the documentation of all available components and examples on how to use them.

Installation

Start with installing the package and its peer dependencies from NPM:

  npm install @newfold/ui-component-library @wordpress/element

Setup

This package assumes the use of tailwindcss for building CSS and therefore ships with Tailwind layered CSS. You can easily set up Tailwind using the TAILWINDCSS_PRESET module.

In your tailwind.config.js, make sure to import this module in your content configuration to prevent Tailwind from purging its styles like so:

import { TAILWINDCSS_PRESET } from "@newfold/ui-component-library";

module.exports = {
    presets: [ TAILWINDCSS_PRESET ],
    content: [
        // Include all JS files inside the UI library in your content.
        ...TAILWINDCSS_PRESET.content,
        "./path/to/your/content/**/*.js",
    ],
};

To include this packages CSS in your build, import it in your stylesheet before the Tailwind layers like so:

/* Import main CSS including all components. */
@import "@newfold/ui-component-library";

/* Tailwind layers */
@tailwind base;
@tailwind components;
@tailwind utilities;

Now that your CSS is set up, you can start using the React components. Always start your React tree with the Root component, which provides a context for general options and a CSS classname for scoping this libraries CSS. Without it, components in this library will not render properly.

import { Root, Alert } from "@newfold/ui-component-library";

export default () => (
    <Root context={ { isRtl: false } }>
        <Alert variant="success">
            Congrats! You've successfully setup the UI library.
        </Alert>
    </Root>
);

Please note that the CSS scoping adds one level of CSS specificity. Therefore TAILWINDCSS_PRESET does the following:

  • Enables the important rule for all utilities.
  • Disables the Tailwind preflight styles (they are included in the Root component's CSS).
  • Configures @tailwindcss/forms to use the class strategy (they are included in the Root component's CSS).

Attribution

This library is a fork of the Yoast UI Library which was introduced in the Yoast SEO 20.0. The library was forked to this newfold repository to more easily contribute to and manage deployments independently of any plugin.

npm-ui-component-library's People

Contributors

wpalani avatar github-actions[bot] avatar circlecube avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.