Skip to content

Repository files navigation

React UI

Standard model of UI development

build statusnpm version

Table Of Contents

Why?

When building React apps a multitude of components is created. They end up scattered across the project, making it hard to control and use them. React UI tries to solve the problem by encapsulating all of the components into a single dependency that is used across the app:

importUIfrom'src/components/ui';constHeader=()=>(<section><UI.Label>Press the button to greet everyone</UI.Label><UI.Buttonkind="primary">Hello, GitHub!</UI.Button></section>);

Usage

npm install --save @react-ui/core

Unlike other UI related libraries, React UI doesn't include any built-in components. It rather suggests a pattern for managing components in an app. So, let's create a React UI-compatible component:

// src/components/ui/basic/button.jsximport'src/styles/button.css';exportdefault()=>(props)=>(<inputtype="button"className={`button-${props.kind}`}>{props.children}</input>);

As you can see, the stateless component is wrapped by a function. It is used for passing styles in more complex use cases (explained later in the docs).

React UI exports only a single function that is used for preparing UI for the app:

// src/components/ui/index.jsimportinitUIfrom'@react-ui/core';importButtonfrom'./button';importLabelfrom'./label';constcomponents={
Button,
Label,};constUI=initUI(components)();exportdefaultUI;

React UI pattern revolves around the following three aspects:

Roadmap

  • docs and examples;
  • core components (as a separate repository);
  • styleguide generator;

If you have a suggestion, please, create an issue.

License

Apache License, Version 2.0

About

Standard model of UI development

Resources

Stars

17 stars

Watchers

4 watching

Forks

Releases

Packages

Used by

Contributors

Languages