open-consul/ui/packages/consul-ui/app/components/state
John Cowen ac65aa80c6
ui: Remove storybook, add docfy (#9831)
This PR removes storybook and adds docfy and uses docfy to render our existing README files.

This now means we can keep adding README documentation without committing any specific format or framework. If we eventually move to storybook then fine, or if we just want to remove docfy for whatever reason then fine - we will still have a full set of README files viewable via GitHub.
2021-03-08 12:22:01 +00:00
..
README.mdx ui: Remove storybook, add docfy (#9831) 2021-03-08 12:22:01 +00:00
index.hbs ui: Move to Workspaced Structure (#8994) 2020-10-21 15:23:16 +01:00
index.js ui: Move to Workspaced Structure (#8994) 2020-10-21 15:23:16 +01:00

README.mdx

## State

`<State @state={{matchableStateObject}} @matches="idle">Currently Idle</State>`

`<State />` is a renderless component that eases rendering of different states
from within templates. State objects could be manually made state objects and
xstate state objects. It's very similar to a normal conditional in that if the
state identifier matches the current state, the contents of the component will
be shown.

### Arguments

| Argument/Attribute | Type | Default | Description |
| --- | --- | --- | --- |
| `state` | `object` |  | An object that implements a `match` method |
| `matches` | `String\|Array` |  | A state identifier (or array of state identifiers) to match on |


### Example

```hbs
<State @state={{state}} @matches="idle">
  Currently Idle
</State>
<State @state={{state}} @matches="loading">
  Currently Loading
</State>
<State @state={{state}} @matches={{array 'loading' 'idle'}}>
  Idle and loading
</State>
```

### See

- [Component Source Code](./index.js)
- [Template Source Code](./index.hbs)

---