Components · Overlays
AnnouncementDialog
A dialog that tells people about something new in the product, with a small label, a title, an optional picture, a few lines of text and an action to try it.
import { AnnouncementDialog } from "@botiverse/raft-ui/wip";An announcement dialog tells people about something new in the product once: a small label, a title, an optional picture, a few lines of text and one action that takes them to it. It is a Dialog with a fixed layout, so it has the dialog's scrim, Esc and focus handling. It is exported from @botiverse/raft-ui/wip, and its API can change in any release.
When to use
| Situation | Use |
|---|---|
| A new feature people should hear about once, with an action to try it | AnnouncementDialog |
| The state of the whole workspace: a computer offline, a quota, an update | The notification center (NotificationCenter) |
| The result of something the person just did | Toast |
| A decision people must make before they continue | Dialog or AlertDialog |
| Something people must read before they act, inside a dialog or form | Banner |
The full choice of how to tell people something is in Choosing a component.
Anatomy
AnnouncementDialog: the root, the same asDialog. Owns the open state. Required.AnnouncementDialogTrigger: the button that opens it, when people open it themselves.AnnouncementDialogContent: the centered surface, with the scrim behind it. Required.AnnouncementDialogBody: everything above the footer. It scrolls when the content is taller than 70% of the window. Required.AnnouncementDialogHeader: the row with the label and the close button.AnnouncementDialogLabel: a short label intext-captionandforeground-muted, after an attention dot that is drawn for you.AnnouncementDialogClose: the × icon button. It isDialogClose.AnnouncementDialogTitle: the title, intext-headline. Required.AnnouncementDialogPicture: a picture of the feature onfill-muted, with a hairline andradius-container. The image inside is contained, not cropped. Optional.AnnouncementDialogText: the text, intext-subheadandforeground-muted. It takes paragraphs, lists and headings.
AnnouncementDialogFooter: the actions, with no line above it.AnnouncementDialogSecondaryAction: a link-style button that dismisses the announcement. Optional.AnnouncementDialogAction: the pink action, at the end of the footer. Required.
Behavior
- On open, focus goes to
AnnouncementDialogActioninstead of the close button, so Enter takes people to the feature. PassinitialFocusto change it. - When the dialog is narrower than 448px, the footer stacks its buttons and each one takes the full width.
- Long titles, labels and button labels wrap instead of being cut off.
- Esc and × close the dialog. The two actions don't close it by themselves: each calls its own handler, and the caller closes the dialog from it.
Content
- Write the label as the kind of announcement, in sentence case: What's new.
- Write the title as what people can now do, in sentence case: Work together across workspaces.
- Make the action say where it goes, in Title Case: Create Joint Channel (Writing).
- Make the secondary action an acknowledgment, such as Got It. Leave it out when the action and × are enough.
Accessibility
- AnnouncementDialog is the Base UI Dialog, through Dialog. It provides the
dialogrole, the focus trap, Esc and focus return. AnnouncementDialogTitlenames the dialog. Every announcement needs one.- Give
AnnouncementDialogCloseanaria-labelthat says what it closes: Close Update. - The attention dot in the label is hidden from assistive technology.
- Give the picture a text alternative, or hide it when the text already says the same thing.
Rules
- Use exactly one
AnnouncementDialogAction. It is the screen's one pink button (Button). - Don't put a form in it. When the feature needs input, open its form from the action.
API
AnnouncementDialogContent
| Prop | Type | Default |
|---|---|---|
| 0 | 1 | ||
| false | DialogOverlayProps | ||
| AlertDialogPortalProps | ||
| "sm" | "md" | "lg" | "wide" | ||
| Determines the element to focus when the dialog is closed. | boolean | RefObject<HTMLElement | null> | ((closeType: InteractionType) => boolean | HTMLElement | null | void) | |
| Determines the element to focus when the dialog is opened. By default, focus moves to the first tabbable element inside the popup, except when the dialog is opened by touch — then the popup itself is focused to avoid opening the virtual keyboard. | boolean | RefObject<HTMLElement | null> | ((openType: InteractionType) => boolean | HTMLElement | null | void) | |
| Allows you to replace the component's HTML element with a different tag, or compose it with another component. | ReactElement | ((props, state) => ReactElement) |
Also takes the attributes of its element.
AnnouncementDialogBody, AnnouncementDialogHeader, AnnouncementDialogLabel
Takes the attributes of its element.
AnnouncementDialogTitle
| Prop | Type | Default |
|---|---|---|
| Allows you to replace the component's HTML element with a different tag, or compose it with another component. | ReactElement | ((props, state) => ReactElement) |
Also takes the attributes of its element.
AnnouncementDialogPicture, AnnouncementDialogText, AnnouncementDialogFooter
Takes the attributes of its element.
AnnouncementDialogAction, AnnouncementDialogSecondaryAction
| Prop | Type | Default |
|---|---|---|
| boolean | ||
| string | ||
| "xs" | "sm" | "md" | "lg" | "xl" | "inline" | "icon-xs" | "icon-sm" | "icon-md" | "icon-lg" | ||
| Whether the button should be focusable when disabled. | boolean | false |
| Whether the component renders a native `<button>` element when replacing it via the `render` prop. Set to `false` if the rendered element is not a button (for example, `<div>`). | boolean | true |
| Allows you to replace the component's HTML element with a different tag, or compose it with another component. | ReactElement | ((props, state) => ReactElement) |
Also takes the attributes of its element.