Activity Feed

<sl-activity-feed> | SlActivityFeed
Since 2.7.0 experimental

Communicates an in-progress activity to the user, showing what’s currently happening and, optionally, what’s still to come. Currently used for AI prompt responses, but suitable anywhere a process needs to signal ongoing activity or loading.

sl-activity-feed always needs data from the consuming application — either steps or wordBank — to know what to display; it has no default text of its own. See the two variants below.

Examples

Single Step

Use this variant for plain text responses, where the specific processing steps aren’t known ahead of time. Leave steps empty and set wordBank to an array of { text, duration } entries; the activity label automatically cycles through them while the AI works, e.g. “Thinking” for the first 8 seconds, then “Analysing” for the next 7, then “Generating response” until the real response arrives and the component is removed.

<sl-activity-feed id="activity-feed-single-demo"></sl-activity-feed>

<script>
  const feed = document.getElementById('activity-feed-single-demo');
  feed.wordBank = [
    { text: 'Thinking...', duration: 8000 },
    { text: 'Analysing...', duration: 7000 },
    { text: 'Generating response...', duration: 5000 }
  ];
</script>

Multiple Steps

Set steps to an array of known, upcoming activity steps — used for system-generated (canned) responses. The first step is shown as the current activity label; the remaining steps queue up below it. Call advance() to promote the next queued step, or playAll() to step through the whole queue automatically (useful for demos — a production app should call advance() as its backend reports progress).

<sl-activity-feed id="activity-feed-demo"></sl-activity-feed>

<script type="module">
  const feed = document.getElementById('activity-feed-demo');
  feed.steps = [
    { id: '1', text: 'Connecting dots across HUB24...' },
    { id: '2', text: 'Gathering accounts and account group' },
    { id: '3', text: 'Running through account checks' },
    { id: '4', text: 'Building account snapshot' }
  ];

  await customElements.whenDefined('sl-activity-feed');
  await feed.updateComplete;
  void feed.playAll();
</script>

[component-metadata:sl-activity-feed]

Properties

Name Description Reflects Type Default
hideSteps
hide-steps
Whether the activity feed steps are visible or not boolean false
steps The steps in activity feed. No inline default here on purpose: a consuming app that sets steps before this element has upgraded (e.g. immediately after inserting it into the DOM) would otherwise have that value silently overwritten back to [] once the constructor runs, since a class-field default assignment always runs after super() restores any pre-upgrade value. See the constructor below for where the actual default is applied. ActivityStep[] []
wordBank
word-bank
A bank of words/phrases, defined by the consuming application, that the activity label cycles through on a timer. Only used for the single-step variant, i.e. when steps is empty — used when the AI is working on a plain text response and the specific processing steps aren’t known ahead of time. No inline default here either, for the same pre-upgrade reason as steps. ActivityWord[] []
stepDelay
step-delay
The time between automatically promoted steps. Used only by playAll() number 400
current The current activity text (step) in activity label - -
queued The remaining activity step(s) queuing in activity pair(s) - -
currentText The text the activity label should be showing: the current step if one is set, otherwise the current word-bank entry. - -
isTypewriterMode Whether the activity label should type its text in character by character. Only used for the single-step, word-bank-driven variant; when steps are known, the label just fades between them instead. - -
updateComplete A read-only promise that resolves when the component has finished updating.

Learn more about attributes and properties.

Methods

Name Description Arguments
advance() Promotes the first queued step to the activity header. May be called by the consuming application whenever its backend indicates that the next processing stage is ready. -
playAll() Demo utility that promotes all steps using stepDelay. Production application can call advance() from backend events instead. -

Learn more about methods.

Parts

Name Description
base The component’s base wrapper.

Learn more about customizing CSS parts.

Dependencies

This component automatically imports the following dependencies.

  • <sl-icon>