Skip to content
This repository was archived by the owner on Mar 4, 2025. It is now read-only.

Commit fdf02fa

Browse files
author
SamGraber
committed
Added documentation for async buttons.
1 parent e0b4d1b commit fdf02fa

File tree

2 files changed

+53
-1
lines changed

2 files changed

+53
-1
lines changed

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ Angular components that can be added to an application.
1616
* [autosaveDialogFooter]()
1717
* [busy]()
1818
* [button](/source/components/button/button.md)
19-
* [buttonAsync]()
19+
* [buttonAsync](/source/components/buttonAsync/buttonAsync.md)
2020
* [buttonLink]()
2121
* [buttonToggle]()
2222
* [cardContainer]()
Lines changed: 52 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,52 @@
1+
# Button Async
2+
Button for triggering asynchronous operations. The async button handles showing a spinner until a promise is resolved. For simple actions, use [button](/source/components/button/button.md) instead.
3+
4+
### Usage
5+
```
6+
<rl-button-async action="" size="" type="" ng-disabled="" right-aligned="" busy=""> ... </rl-button>
7+
```
8+
### Options
9+
10+
#### `action`
11+
12+
The expression in the **action** will be triggered when the button is clicked. If the action returns a promise, the button will show a spinner until the promise resolves. If the action returns true, the button will show a spinner until told to do otherwise via the busy option.
13+
14+
#### `busy`
15+
16+
This option allows you to show/hide the spinner via a binding. This is useful in cases where simply returning a promise from the action isn't sufficient.
17+
18+
#### `right-aligned`
19+
20+
Specifies if the button is within a right aligned context. Defaults to `false`. This is used by the button to determine which side the spinner should show on.
21+
22+
#### `size`
23+
24+
This will set the **size** of the button. We use the following sizes: `xs`, `sm`, `md`, `lg`. This option is applied to the button's class attribute and prefixed with `btn-`.
25+
26+
Example: `size="lg"` will ouput `class="btn-lg"`.
27+
28+
#### `type`
29+
30+
This option sets the button's **visual type**. This option defaults to `default`. We use the following types: `primary`, `success`, `danger`, `info`, `warning`, `link`. This option is applied to the button's class attribute and prefixed with `btn-`.
31+
32+
Example: `type="danger"` will output `class="btn-danger"`.
33+
34+
35+
#### [`ng-disabled`](https://docs.angularjs.org/api/ng/directive/ngDisabled)
36+
37+
This option will set `disabled` on the button if the [expression](https://docs.angularjs.org/guide/expression) inside it is truthy.
38+
39+
Example: `ng-disabled="true"` will output `<button disabled> ... </button>`
40+
41+
### Full Example
42+
An async button with an **action**, **size**, **type**, **right-align** and **busy**.
43+
```
44+
<rl-button action="button.click()" size="lg" type="danger" ng-disabled="false" right-aligned="true" busy="true"> ... </rl-button>
45+
```
46+
Output:
47+
```
48+
<button type="button" class="btn btn-lg btn-danger" ng-click="button.click()" disabled>
49+
<rl-busy loading="true"></rl-busy>
50+
...
51+
</button>
52+
```

0 commit comments

Comments
 (0)