Capabilities
Client Library
Color Theme Compliance (Beta)
UI Functions

Alert

Infrequently, it may be necessary to alert the user that something is underway (so they shouldn't close the tab), or that something has gone wrong. In these rare cases, you may use t.alert to notify a user of something. Please don't overuse this, and tend towards t.popup where more appropriate.

t.alert(opts)

Please don't overuse this

Alerts are purposefully noisy. Showing them more than necessary can get very annoying for your users. Tend towards t.popup where more appropriate.

1
2
// you can also use the t you get in a capability function
var t = window.TrelloPowerUp.iframe();

// simplest alert requires just a message
// displays for 5 seconds using the 'info' display
t.alert({
  message: 'Powering-Up, give us a second...'
});

// more complex alert
t.alert({
  message: 'Powered-Up Successfully 🎉',
  duration: 6,
});
ParameterOptionsDetails
messagerequiredThe message to display to the user.
durationoptional
Default: 5
Minimum: 5
Maximum: 30
How long you want the alert displayed for, in seconds. Try to be brief.

One Alert At A Time

While alerts from multiple Power-Ups & Trello itself will stack vertically, each Power-Up is limited to showing at most one alert at a time. If you trigger a new alert while one is already showing, the previous one will be removed in favor of the new one.

t.hideAlert()

When showing alert messages to the user, you might be communicating a long running operation which you don't know beforehand how long it will take. In these cases you can use an alert with a long duration, and when the operation completes, you can hide the alert manually by calling t.hideAlert().

1
2
// you can also use the t you get in a capability function
var t = window.TrelloPowerUp.iframe();

// show an alert for a bit, we don't know how long it will
// take so we will hide it manually when its done
t.alert({
  message: 'Working on it, hang tight...',
  duration: 30, // don't worry we will close it sooner
});

// some time later once the operation is complete
window.setTimeout(t.hideAlert, 8000);

No Alerts Showing

If you call t.hideAlert() and you are currently showing no alerts, nothing will happen, and no error will be thrown. It is essentially a no-op.

Rate this page: