1.1.1 • Published 9 months ago

@tabula/ui-status-badge v1.1.1

Weekly downloads
-
License
ISC
Repository
github
Last release
9 months ago

@tabula/ui-status-badge

Status badges are used for showing a small amount of color categorized metadata about something state.

Installation

Use the package manager pnpm to install @tabula/ui-status-badge.

pnpm add @tabula/ui-status-badge

You can use npm or yarn too.

Usage

You can import UiStatusBadge component and use for your purposes:

import { useState } from 'react';

import { UiStatusBadge, UiStatusBadgeVariant } from '@tabula/ui-status-badge';

import { doAction } from './actions';

export function AwesomeComponent() {
  const [label, setLabel] = useState("Idle");
  const [variant, setVariant] = useState<UiStatusBadgeVariant>("inactive");

  useEffect(() => {
    setLabel("Running");
    setVariant("active");

    doAction()
      .then(() => {
        setLabel("Succeed");
        setVariant("success");
      })
      .catch(() => {
        setLabel("Failed");
        setVariant("error");
      });
  }, []);

  return <UiStatusBadge variant={variant}>{label}</UiStatusBadge>;
}

Options

icon

By default, we show default icon if possible.

You can provide false as icon property to disable icon at all.

Or you can provide your own icon as icon property.

License

This project is ISC licensed.

1.1.1

9 months ago

1.1.0

9 months ago

1.1.0-next.0

9 months ago

1.0.2

9 months ago

1.0.3

9 months ago

1.0.1

10 months ago

1.0.0

10 months ago

1.0.0-next.0

10 months ago

0.1.2

11 months ago

0.1.1

11 months ago

0.1.0

11 months ago