npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

react-ui-expert

v0.1.5

Published

![Logo](https://res.cloudinary.com/df0rs0jdj/image/upload/v1698666652/npm/react-ui-expert-logo.svg)

Downloads

22

Readme

react-ui-expert

Logo

Introdution

This lib based on css-in js concept and allows pass all the common css properties as a props of you own or built-in react components. Using styled-components underhood lib provides own version of most UI tags (elements) with prepared props (could be extended).

Let`s dive in!

Installation

To star using this lib you will be fine with just have npm i react-ui-expert running in the terminal of your project. Types are included.

Documentation

After installation let`s see what we have here. Lib has 3 types of components:

  • Common - Body, H1-H5, A, Section and so on.
  • Layout based - Flex, FlexColumn, FlexRow, Grid
  • Custom - using Element component you can create your own instances with needed props

Everything you need for basic usage is accessible by following import: import {name_of_needed_component} from "react-ui-expert"

Let`s see some basic example of usage components:

import UI, { FlexColumn, FlexRow, H1, H3 } from "react-ui-expert";

function App() {
  return (
    <div className="App">
      <FlexColumn height="100vh" background="blue">
        <header className="App-header">
          <FlexRow
            // you can pass any known CSS props in camel-case notation, it`s typizated
            width="100%"
            height="20%"
            alignItems="center"
            justifyContent="center"
            background="grey">
            <H1 color="red">Hello</H1>
            <H3>Hello</H3>
            <H3>Hello world</H3>
          </FlexRow>
        </header>
      </FlexColumn>
    </div>
  );
}

You may wonder what is the diff between style attribute and this then. The answer is simple - style in react is based on simple inline-styles approach and this is last thing you should do with your components in react. Meanwhile react-ui-expert works with styled-components lib, allowing you adjust all passed styles as separate style with custom className underhood. There is also an option to pass multiple class-based styles of course. You can readme more here https://styled-components.com/docs/basics

Custom theming

Additionaly react-ui-expert supports theme management. To implement custom theming you should use createUITheme function and UIThemeProvider.

This is how it looks like:

import { UIThemeProvider, createUITheme } from "react-ui-expert";

function App() {
  return (
    <div className="App">
      <FlexColumn height="100vh" background="blue">
        <header className="App-header">
          <UIThemeProvider theme={theme}>
            // theme goes here
            <FlexRow
              width="100%"
              height="20%"
              alignItems="center"
              justifyContent="center">
              <H1 color="red">Hello</H1>
              <H3>Hello</H3>
              <H3>Hello world</H3>
            </FlexRow>
          </UIThemeProvider>
        </header>
      </FlexColumn>
    </div>
  );
}

To create a theme with our lib you can use this way:

const theme = createUITheme(
  {
    gaps: {
      xl: "20px",
      l: "10px",
      m: "5px",
      s: "2px",
      xs: "0.5px",
    },
  },
  [
    {
      background: "black",
      primary: "white",
      secondary: "grey",
      text: "white",
      shadows: "black",
    },
    {
      background: "red",
      primary: "green",
      secondary: "yellow",
      text: "grey",
      shadows: "black",
    },
  ],
  {
    H1: { margin: 0 },
    H3: { margin: "40px" },
  }
);

createUITheme(spacings, variations, overrides) expects 3 arguments:

  • Spacings object with optional fields gaps, margins, paddings where you can define main spacings of your layouts starting with xs - extra small and finishing with xl - extra large
  • Variations - main color pallets of themes you will use (could be one or more)
  • Overrides - common rules for certain UI tag, generally just an object where you can define basic ovverides for certain lib components.