Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

docs(usage): inline-loading #1562

Merged
merged 8 commits into from
Aug 17, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file not shown.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file not shown.
Binary file not shown.
Binary file not shown.
115 changes: 88 additions & 27 deletions src/pages/components/inline-loading/usage.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,7 @@ tabs: ['Usage', 'Style', 'Code', 'Accessibility']

<PageDescription>

The inline loading component provides visual feedback that a user's action is
being processed.
The inline loading component provides visual feedback that data is being processed.

</PageDescription>

Expand All @@ -18,7 +17,9 @@ being processed.
<AnchorLink>Overview</AnchorLink>
<AnchorLink>Live demo</AnchorLink>
<AnchorLink>Formatting</AnchorLink>
<AnchorLink>States</AnchorLink>
<AnchorLink>Content</AnchorLink>
<AnchorLink>Behaviors</AnchorLink>
<AnchorLink>Related</AnchorLink>
<AnchorLink>Feedback</AnchorLink>

</AnchorLinks>
Expand All @@ -30,9 +31,17 @@ user that their request is being processed. Although they do not provide details
about what is occurring on the back-end, they reassure the user that their
action is being processed.

Use an inline loading component for any Create, Update, or Delete actions. It
can be used in a table, after a primary or secondary button click, or even in a
modal.
Common actions that benefit from inline loading include any create, update, or delete actions that may have a lot of data to process. It can be used in a table, after a primary or secondary button click, or even in a modal.

### When to use

- Use an inline loading component for any action that cannot be performed instantly and will only require a short time to process.
- Use when retrieving or refreshing small data amounts, such as status.

### When not to use

- Don't use inline loading for full page loads, use skeleton states instead.
- Don't trigger inline loading on more than one item or action at a time, unless on initial page load or refresh.

## Live demo

Expand Down Expand Up @@ -63,61 +72,113 @@ modal.

## Formatting

- If the inline loading is being used to submit a form, the form fields should
get disabled.
### Anatomy

<Row>
<Column colLg={8}>

![Example of inline loading](images/inline-loading-anatomy.png)

</Column>
</Row>

1. **Loading status**: indicates the state of the loading sequence (active, inactive, finished, error).
2. **Label**: assistive text that explains the loading status.

### Placement

When inline loading temporarily replaces content, it should appear in the same spot as the content it replaced and maintain the same alignment.

<Row>
<Column colLg={8}>

![Example of inline loading placement](images/inline-loading-alignment.png)

</Column>
</Row>

## Content

### Main elements

Descriptive loading text for the action is optional, but encouraged. If you have limited room or find adding text to be unnecessary you can just run through the animations.

#### Active loading label

- Descriptive text for the action is optional, but encouraged. If you have
limited room or find adding text to be unnecessary you can just run through
the animations.
This is the text that appears while the action is happening. The label should tell the user what action is being performed. For example, if it appears while a form is being save then it should say "Saving ...".

- The _success_ state of the inline loading component is active for 1.5 seconds
before calling a optional function onSuccess. Use the onSuccess function to
refetch new data, close a modal, or reset a form. If no function is specified
the success state will last indefinitely.
#### Finished loading label

- If an error occurs, the Inline loading component should be hidden and a error
notification should be added or error handling within a form should appear.
Once the action has finished, the label should change to tell the user that the action was completed successfully. For example, when saving a form it would read "Saved" upon completion.

- The inline loading component should never be used to load a page or data.
#### Error loading label

## States
If the action fails then the label should change to tell the user that an error or failure has occurred.

#### Loading
### Further guidance

The _loading_ state indicates that the action is still in progress.
For further content guidance, see Carbon's [content guidelines](<[https://www.carbondesignsystem.com/guidelines/content/general](https://www.carbondesignsystem.com/guidelines/content/general)>).

## Behaviors

### States

There are four states to inline loading: inactive, active, success, and error.

<Row>
<Column colLg={8}>

![Example of inline loading](images/inline-loading-usage-1.png)
![Example of inline loading states](images/inline-loading-states.png)

</Column>
</Row>

#### Inactive

The inactive loading state is when no data is being loaded. Inactive has no visual indicator.

#### Active

The active loading state indicates that the action is still in progress.

#### Success

The _success_ state indicates that the action completed successfully.
The success loading state indicates that the action completed successfully. The success state is active for 1.5 seconds before calling an optional function `onSuccess`. Use the `onSuccess` function to refetch new data, close a modal, or reset a form. If no function is specified the success state will last indefinitely.

#### Error

The error loading state indicates that the action did not successfully complete. If an error occurs, the inline loading component becomes inactive and an inline notification or error handling within the form should appear.

### Interactions

Any interactive elements associated with the item that is loading should be disabled until the loading is complete. For example, in a file uploader the item that is loading is disabled until fully uploaded. If the inline loading is being used to submit a form, the form fields should be disabled until the loading is complete.

<Row>
<Column colLg={8}>

![Example of loading success](images/inline-loading-usage-2.png)
![Example of inline loading with disabled elements](images/inline-loading-interactions.png)

</Column>
</Row>

#### Error
### Modifiers

The _error_ state indicates that the action did not complete successfully.
A loading spinner can be used by itself without a label. It is most commonly used this way inside a field input.

<Row>
<Column colLg={8}>

![Example of loading error](images/inline-loading-usage-3.png)
![Example of a standalone spinner](images/inline-loading-modifier.png)

</Column>
</Row>

## Related

- [Loading](/components/loading/usage)
- [Skeleton states](https://www.carbondesignsystem.com/patterns/loading-pattern#skeleton-states)
- [Loading pattern](/patterns/loading-pattern)

## Feedback

Help us improve this component by providing feedback, asking questions, and
Expand Down