Announcements

Write a message once in Studio and show it in every app that asks — release notes, maintenance windows, a feature to try.

PanelUI components are native-only for now

Announcements work on the web through the SDK. The PanelUI components the App version shows them with — Alert and Button — are React Native components and don't run in a browser yet. A banner on the web is the same banner in plain markup.

Announcements are published in Studio (Announcements in the project) with a title, a message and an optional button, for a window of time and for the platforms you choose. Apps ask for the live ones; each install can dismiss them. Free workspaces can have one live announcement at a time; Pro and Max have no limit.

Show them

import { useAnnouncements } from 'panelui-studio/react';

export function AnnouncementBanner() {
  const { announcements, seen, dismiss } = useAnnouncements();
  const next = announcements[0];
  if (!next) return null;

  return (
    <Banner
      title={next.title}
      body={next.body}
      action={next.cta ? { label: next.cta.label, href: next.cta.url } : undefined}
      onShow={() => seen(next.id)}
      onClose={() => dismiss(next.id)}
    />
  );
}
  • announcements holds what this install should show now: published, inside its start and end, for this platform, and not dismissed. Newest first.
  • seen(id) records a view — Studio shows how many installs saw each one. It doesn't hide it.
  • dismiss(id) hides it for this install for good, straight away.

Without React: studio.announcements.list(), .seen(id) and .dismiss(id).

A website reports its platform as web. An announcement with no platforms picked reaches every platform; one limited to iOS and Android never reaches your site, so tick Web too.

A banner on the web

components/announcement-banner.tsx
'use client';

import { useEffect } from 'react';
import { useAnnouncements } from 'panelui-studio/react';

export function AnnouncementBanner() {
  const { announcements, seen, dismiss } = useAnnouncements();
  const next = announcements[0];

  // Count the view once it's on screen; seen() doesn't hide it.
  useEffect(() => {
    if (next && !next.seen) void seen(next.id);
  }, [next, seen]);

  if (!next) return null;

  return (
    <aside role="status">
      <strong>{next.title}</strong>
      <p>{next.body}</p>
      {next.cta ? <a href={next.cta.url}>{next.cta.label}</a> : null}
      <button type="button" onClick={() => dismiss(next.id)}>
        Dismiss
      </button>
    </aside>
  );
}

next.seen is true once this install has recorded a view, so each browser counts once in Studio's Seen by column.

Usage with PanelUI

An announcement is plain text, so it fits any banner. If your app uses PanelUI, an Alert at the top of a screen works well, with the announcement's button and a Dismiss:

components/announcement-banner.tsx
import { useEffect } from 'react';
import { Linking, View } from 'react-native';
import { Alert, Button } from 'panelui-native';
import { useAnnouncements } from 'panelui-studio/react';

export function AnnouncementBanner() {
  const { announcements, seen, dismiss } = useAnnouncements();
  const next = announcements[0];

  // Count the view once it's on screen; seen() doesn't hide it.
  useEffect(() => {
    if (next && !next.seen) void seen(next.id);
  }, [next, seen]);

  if (!next) return null;

  return (
    <Alert variant="info">
      <Alert.Indicator />
      <Alert.Content>
        <Alert.Title>{next.title}</Alert.Title>
        <Alert.Description>{next.body}</Alert.Description>
        <View className="flex-row gap-2 pt-3">
          {next.cta ? (
            <Button size="sm" onPress={() => Linking.openURL(next.cta!.url)}>
              {next.cta.label}
            </Button>
          ) : null}
          <Button size="sm" variant="ghost" onPress={() => dismiss(next.id)}>
            Dismiss
          </Button>
        </View>
      </Alert.Content>
    </Alert>
  );
}

next.seen is true once this install has recorded a view, so each install counts once in Studio's Seen by column.

An info Alert on an iPhone: Studio is live, with a Read the docs button and Dismiss.
An announcement published in Studio, shown until the user dismisses it.

On this page