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

mobrix-ui

v4.2.0

Published

Smart React components for every app, easily customizable for every purpose

Downloads

1,209

Readme

MoBrix-ui

NPM npm (scoped) Maintenance

npm bundle size (scoped) tested with jest MoBrix-ui CI


Note for older MoBrix-ui version

If you still want to use older MoBrix-ui versions, check older MoBrix-ui versions guides .

(Upgrade it to v4.X.X if possible!)


Summary


Check out the official MoBrix-ui guide page for more details


MoBrix-ui philosophy

This library is built upon few (but important) concepts:

  • Small library size, to not impact on final app bundle size
  • Few dependencies, to not introduce a bunch of additional packages (that could also introduce bugs or version conflicts with pre-existent packages)
  • Let the user customize every part as desired, but with default values set otherwise, to make every component ready to be used without so many parameters
  • Every component should be integrable into every react app, so their behaviour must be easily customizable too

The same concepts are also the base of another project I maintain, MoBrix-engine (check it out, it is also the base of MoBrix-ui guide page !)


Components building process

This library use a standardized process to build every component. As result, every component has a shared initial logic, shared CSS styles and shared properties. Some properties are shared between all components, for a smoother dev experience. In addition, this makes every single component easily re-usable.


Shared Properties

MoBrix-ui components shares some properties:

| Parameter | Type | Default | | ----------------------------------------------------------- | --------------------------------------------------------- | ------------------------------------------------------------- | | key | string | / | | className | string | / | | dark | boolean | false | | hide | boolean | false | | id | string | / | | shadow | boolean | true | | style | CSSProperties | / | | unstyled | boolean | false | | animated | boolean | true | | animation | fade-in | slide-in-left | slide-in-right | slide-in-top | shake | / | | background | boolean | true | | hover | boolean | true | | active | boolean | false | | disabled | boolean | false | | onKeyDown | (keyEvent : any) => void | / | | onFocus | () => void | / | | onFocusLost | () => void | / | | props | Record<string, any> | / | | a11y | boolean | true | | a11yLabel | string | / | | tabIndex | number | string | / |

Check out the complete components list for more details

CSS variables

MoBrix-ui is globally configurable, with CSS variables. By defining some specific custom CSS variables into your app css, you'll change the UI of all components:

| Css variable | Fallback | Default | | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | | --mbx-background | / | / | | --mbx-background-light | --mbx-background | linear-gradient(to right, #fff, #ededee, #e6e7e7) | | --mbx-background-dark | --mbx-background | linear-gradient(to right, #2d3748, #1d232e) | | --mbx-background-color | / | / | | --mbx-background-color-light | --mbx-background-color | #e9e9e9 | | --mbx-background-color-dark | --mbx-background-color | #1d232e | | --mbx-background-color-hover | / | / | | --mbx-background-color-hover-light | --mbx-background-color-hover | #dfeaf8 | | --mbx-background-color-hover-dark | --mbx-background-color-hover | #3a3552 | | --mbx-background-hover | / | / | | --mbx-background-hover-light | --mbx-background-hover | linear-gradient(to right, #ececec, #e1e1e6, #dbdddd) | | --mbx-background-hover-dark | --mbx-background-hover | linear-gradient(to right, #364257, #252d3b) | | --mbx-text | / | / | | --mbx-text-light | --mbx-text | #1b1b1b | | --mbx-text-dark | --mbx-text | white | | --mbx-text-hover | / | / | | --mbx-text-hover-light | --mbx-text-hover | #413c5c | | --mbx-text-hover-dark | --mbx-text-hover | #dfeaf8 | | --mbx-shadow | / | / | | --mbx-shadow-light | --mbx-shadow | #464545 | | --mbx-shadow-dark | --mbx-shadow | #464545 | | --mbx-focus-color | / | / | | --mbx-focus-color-light | --mbx-focus-color | #7785ff | | --mbx-focus-color-dark | --mbx-focus-color | #fb7a10 |

Check out the complete components list for more details

Reactive components

Some components are designed with a specific structure, to sync their internal state with an external input value. This kind of component handle internally their actual value, using the value parameter as starting point. This let the component to be driven in 2 different way:

  • Internally, Its internal value, when using the component without changing its value parameter from code

  • External, passing the value parameter

So, we have 2 scenarios:

  • If you change the component value using the component (without changing the value parameter), it will be updated internally.

  • If you change the passed value parameter, the component will sync its value with the given one.

A clear example is the Input component. When changing the value parameter, the component will sync its actual value.



Getting started

Installation

If you want to use this library inside your project, just install it:


npm i mobrix-ui

Usage

After installation, you can use every MoBrix-ui component in your app. Run this example to see them in action:

import { Card, Container, Link } from "mobrix-ui";
import { render } from "react-dom";

render(
  <Container animated>
    <Card
      dark={true}
      body={<p>This page is entirely made with MoBrix-ui components !</p>}
      footer={
        <Link to="https://cianciarusocataldo.github.io/mobrix-ui">
          MoBrix-ui page
        </Link>
      }
    />
  </Container>,
  document.getElementById("root"),
);

Try it !

If you want to customize the UI globally, initialize the dedicated CSS variables:

* {
  --mbx-text: #f5f5f5;
  --mbx-background-color: #1b1b1b;
  --mbx-container-background: green;
  --mbx-card-background: orange;
}


Tests

Unit tests for every component are located inside tests folder. The test script is executed with pre-defined test command:

npm run test

Authors

License

This project is licensed under the MIT License - see the LICENSE file for details