import {SymbolDoc, Specifications} from '@workday/canvas-kit-docs';

import {StatusIndicator} from '@workday/canvas-kit-preview-react/status-indicator';
import Basic from './examples/Basic';
import Emphasis from './examples/Emphasis';
import Icon from './examples/Icon';
import Overflow from './examples/Overflow';
import Variants from './examples/Variants';


# Canvas Kit Status Indicator

Status Indicators help the user quickly identify the status of a task, action, or page element.

## Installation

```sh
yarn add @workday/canvas-kit-preview-react
```

## Usage

### Basic Example

`StatusIndicator` includes a container `StatusIndicator` component and the following subcomponents
which can be composed in a variety of ways: `StatusIndicator.Label` and `StatusIndicator.Icon`.

A basic `StatusIndicator` with a `StatusIndicator.Label` will render text with a gray background and
low emphasis.

<ExampleCodeBlock code={Basic} />

### Emphasis

Set the `emphasis` prop of `StatusIndicator` to adjust the contrast between the text and background
color. Emphasis is typically used to convey more visual urgency.

`emphasis` accepts `high` or `low`.

<ExampleCodeBlock code={Emphasis} />

### Icon

Use `StatusIndicator.Icon` to add an icon to the `StatusIndicator` as a visual decorator. The
position of the icon may be adjusted depending on where you place it in the markup.

<ExampleCodeBlock code={Icon} />

### Overflow

We **strongly** discourage using text in a `StatusIndicator` which will cause it to exceed its
maximum width of `200px`. In situations where this cannot be avoided and text must be overflowed, we
suggest wrapping `StatusIndicator` in an `OverflowTooltip` and applying `tabIndex={0}` to it so the
overflowed text is accessible via keyboard and mouse. You may also override the default `maxWidth`
of `StatusIndicator` via [style props](/getting-started/for-developers/resources/style-props/).

<ExampleCodeBlock code={Overflow} />

### Variants

Set the `variant` prop of `StatusIndicator` to adjust its background color. `variant` accepts the
following values:

- `gray`
- `orange`
- `blue`
- `green`
- `red`
- `transparent`

The background color dictated by the `variant` will be dark or light based on the `emphasis`.

<ExampleCodeBlock code={Variants} />

## Component API

<SymbolDoc name="StatusIndicator" fileName="/preview-react/" />