@nanlabs/react-ui
TypeScript icon, indicating that this package has built-in type declarations

0.4.9 • Public • Published

React Components

Documentation | Contributing

Continious Integration npm npm License: MIT

This library provides a set of React components that can be used in any React application.

Installation

npm install @nanlabs/react-ui

Usage

The following example shows how one of the multiple hooks provided by this library can be used.

In the example bellow we use the Image component to render an image with a list of fallbacks and retrying on error.

You can find more examples in the documentation.

import React from "react";
import { Image } from "@nanlabs/react-ui";

const Component = () => (
  <Image
    src="https://picsum.photos/400"
    fallback={["https://picsum.photos/300", "https://picsum.photos/200"]}
    maxRetry={3}
    retryDelay={1000}
    initialTimeout={1000}
    decoding="async"
    loading="lazy"
    className="async-image"
    onLoad={() => console.log("Image loaded!")}
    style={{
      width: "300px",
      objectFit: "cover",
    }}
  />
);

Readme

Keywords

none

Package Sidebar

Install

npm i @nanlabs/react-ui

Weekly Downloads

28

Version

0.4.9

License

MIT

Unpacked Size

49.3 kB

Total Files

5

Last publish

Collaborators

  • ulises-jeremias
  • nanlabs1