ember-ladda-button v2.2.2
ember-ladda-button
Ember wrapper for Ladda spinner buttons.
Installation
ember install ember-ladda-buttonUsage
The button is themeless, so you will need to style it yourself.
Example usage:
<LaddaButton
@action={{this.functionThatDoesNotReturnPromise}}
@buttonStyle="zoom-out"
@inFlight={{this.inFlight}}
@text="My Button"
@type="submit"
/>
<LaddaButton
@action={{this.functionThatReturnsPromise}}
@buttonStyle="expand-down"
@longAction={{this.otherFunctionThatReturnsPromise}}
@longDelay={{400}}
as |longPress longProgress|
>
{{#if longPress}}
Long Press Text
{{else}}
Short Press Text
{{/if}}
{{longProgress}}% of the way to a long press!
</LaddaButton>You can set the default spinner style attributes using the included service:
@service laddaButton;
constructor() {
super(...arguments);
this.laddaButton.buttonStyle = 'expand-left';
this.laddaButton.spinnerColor = '#007eff';
this.laddaButton.spinnerLines = 10;
this.laddaButton.spinnerSize = 30;
}The arguments you can pass are:
action- The function to call when the button is clicked. If this returns a promise, the button will start spinning when it is clicked, and stop spinning when the promise resolves or rejects. (defaults toundefined)actionWithEvent- Identical toactionexcept the click event is passed through as the first arg. (defaults toundefined)buttonStyle- How the spinner should appear while it is active -'expand-left'|'expand-right'|'expand-up'|'expand-down'|'contract'|'contract-overlay'|'zoom-in'|'zoom-out'|'slide-left'|'slide-right'|'slide-up'|'slide-down'- (defaults to'expand-right')disabled- Thedisabledattribute for the button element - (defaults tofalse)inFlight- Whether the button should currently be spinning (alternative to returning a promise inaction) - (defaults tofalse)longAction- Identical toactionexcept will be called after the button is held forlongDelayms (see below) (defaults toundefined)longActionWithEvent- Identical tolongActionexcept the click event is passed through as the first arg. (defaults toundefined)longDelay- How many milliseconds it should take before the button has been considered long pressed (seelongAction). If no value is passed, long press functionality will be disabled.longPressandlongProgressare yielded when passing a block for updating the appearance (defaults toundefined)spinnerColor- The colour of the spinner - any valid CSS colour value - (defaults to#fff)spinnerLines- The number of lines to be displayed in the spinner - (defaults to 12)spinnerSize- Pixel dimensions of the spinner - (defaults to dynamic size based on the button height)text- Text to be displayed on the button (alternative to passing a block) (defaults toundefined)type- Thetypeattribute for the button element -button|reset|submit- (defaults tobutton)
1 year ago
1 year ago
1 year ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
5 years ago
5 years ago
6 years ago
6 years ago
6 years ago
6 years ago
6 years ago
6 years ago
6 years ago
6 years ago
6 years ago
6 years ago
6 years ago
7 years ago
7 years ago
7 years ago
7 years ago
7 years ago
7 years ago
7 years ago
7 years ago
7 years ago
7 years ago
7 years ago
7 years ago
7 years ago
7 years ago
7 years ago
7 years ago