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
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.
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 servers.
- Make the action say where it goes, in sentence case: Create joint channel (Writing).
- When there is nothing to try, the one action is the acknowledgment: Got it.
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). - With an action that takes people to the feature, show it alone: no Got it beside it. × already dismisses the announcement, so a Got it there would be a second button that does what × does.
- With nothing to try, keep the pink action as Got it, and keep ×. The dialog still has one clear button to end on, even when all it does is close.
- Don't put a form in it. When the feature needs input, open its form from the action.
API
AnnouncementDialogContent
Also takes the attributes of its element.
AnnouncementDialogBody
Also takes the attributes of its element.
AnnouncementDialogHeader, AnnouncementDialogLabel
Takes the attributes of its element.
AnnouncementDialogTitle
Also takes the attributes of its element.
AnnouncementDialogPicture, AnnouncementDialogText, AnnouncementDialogFooter
Takes the attributes of its element.
AnnouncementDialogAction, AnnouncementDialogSecondaryAction
Also takes the attributes of its element.
Related
Changes
- 0.73.0 · ChangedEvery region that scrolls is a ScrollArea:
PanelScrollViewport,ActivityInboxViewport,SearchShellViewport,NotificationCenterScroller,FilesViewport,TasksPanelViewport, ChoiceList's scroller,MobileNavServerPopoverList,ComposerSuggestionList,AnnouncementDialogBody,MessageActionCardScopeListViewportandDialogNavshow ScrollArea's overlay scrollbar instead of the platform's. Native scrolling stays only in the places scroll-area.md lists, each with its reason, and a test fails on any other. - 0.8.0 · Breaking Changes
AnnouncementDialogSecondaryActionis a ghost button instead of an underlined link. Its API is unchanged, and it now looks like the frameless minor action of a dialog.