Skip to content
CraftDocs
GitHub
Home
Home
Changelog
What's New
Guide
Guide
Getting Started
Principles
Styling Components
Theme System
Foundations
All Tokens
Color
Elevation
Icons
Motion
Shape
Spacing
Typography
Libraries
Libraries
@xds/cli
@xds/core
Themes
Themes
Theme: daily
Default Theme
Theme: matcha
Neutral Theme
Components
Components
AppShell
AspectRatio
Avatar
Avatar
AvatarStatusDot
Badge
Banner
Breadcrumbs
BreadcrumbItem
Breadcrumbs
Button
Button
IconButton
ToggleButton
ToggleButtonGroup
Calendar
Card
Carousel
Chat
ChatComposer
ChatComposerDrawer
ChatComposerInput
ChatComposerTokenElement
ChatDictationButton
ChatLayout
ChatLayoutScrollButton
ChatMessage
ChatMessageBubble
ChatMessageList
ChatMessageMetadata
ChatSendButton
ChatSystemMessage
ChatTokenizedText
ChatToolCalls
Checkbox
CheckboxInput
CheckboxList
CheckboxListItem
ClickableCard
Code
CodeBlock
Collapsible
Collapsible
CollapsibleGroup
useXDSCollapsible
CommandPalette
CommandPalette
CommandPaletteEmpty
CommandPaletteFooter
CommandPaletteGroup
CommandPaletteInput
CommandPaletteItem
CommandPaletteList
DateInput
Dialog
AlertDialog
Dialog
DialogHeader
useXDSImperativeAlertDialog
useXDSImperativeDialog
Divider
DropdownMenu
DropdownMenu
DropdownMenuDivider
DropdownMenuItem
DropdownMenuItemData
DropdownMenuSection
EmptyState
Field
Field
FieldLabel
FieldStatus
Heading
HoverCard
Icon
Kbd
Layout
Center
FormLayout
Grid
GridSpan
HStack
Layout
LayoutContainer
LayoutContent
LayoutFooter
LayoutHeader
LayoutPanel
Section
StackItem
VStack
Link
List
List
ListItem
Markdown
MetadataList
MetadataList
MetadataListItem
MobileNav
MoreMenu
NavIcon
NavMenuItem
NumberInput
OverflowList
Pagination
Popover
PowerSearch
ProgressBar
Radio
RadioList
RadioListItem
Resizable
ResizeHandle
useXDSResizable
SegmentedControl
SegmentedControl
SegmentedControlItem
SelectableCard
Selector
MultiSelector
Selector
SelectorOption
SideNav
SideNav
SideNavCollapseButton
SideNavHeading
SideNavItem
SideNavSection
Skeleton
Slider
Spinner
StatusDot
Switch
Table
BaseTable
Table
TableCell
TableHeaderCell
TableRow
useXDSTableColumnSettings
useXDSTablePagination
useXDSTableSelection
useXDSTableSelectionState
useXDSTableSortable
Tabs
Tab
TabList
TabMenu
Text
TextArea
TextInput
Thumbnail
TimeInput
Timestamp
Toast
Toast
useXDSToast
Token
Tokenizer
Toolbar
Tooltip
TopNav
TopNav
TopNavHeading
TopNavItem
TopNavMegaMenu
TopNavMegaMenuFeaturedCard
TopNavMegaMenuItem
TopNavMenu
TreeList
Typeahead
BaseTypeahead
Typeahead
TypeaheadItem
useXDSHoverCard
useXDSPopover
useXDSTooltip
Utilities
Utilities
LinkProvider
MediaTheme
SyntaxTheme
Theme
useClickableContainer
useEntryAnimation
useFocusTrap
useGridFocus
useImageMode
useInputContainer
useListFocus
useMediaQuery
useOverflow
useScrollLock
useScrollOverflow
useXDSLayer
useXDSStreamingText
Terms of UsePrivacy Policy
Type to search
↑↓Navigate↵SelectEscClose
Banner@xds/core · XDSBanner v0.0.13

Usage

Banner shows a persistent message at the top of a page or section. Use it for form errors, system updates, maintenance notices, or success confirmations that the user needs to see until they act on it.
ts
import {XDSBanner} from '@xds/core/Banner'

Best practices

GuidancePractices
DoPick a status that matches the message: info for updates, warning for caution, error for problems, success for confirmations.
DoUse the card container inside page content and the section container for full-width messages that span the entire page.
DoMake info and success banners dismissable. Keep error banners visible until the user fixes the issue.
DoKeep titles short and scannable — "Payment failed" not "There was a problem processing your most recent payment."
Don'tUse Banner for short-lived messages that disappear on their own — use Toast instead.
Don'tStack multiple banners with the same status — combine related messages into one banner.

Examples

Common configurations, variations, and states.
Banner — ActionAdd a button to a banner so the user can act on the message. Use for trial expirations, payment failures, or anything that needs a response.
tsx
'use client';
​
import {XDSBanner} from '@xds/core/Banner';
import {XDSButton} from '@xds/core/Button';
import {XDSStack} from '@xds/core/Layout';
​
export default function BannerWithActionButton() {
return (
<XDSStack direction="vertical" gap={3}>
<XDSBanner
status="info"
title="Your trial expires in 3 days"
description="Upgrade now to keep access to all features."
endContent={<XDSButton label="Upgrade" variant="secondary" size="sm" />}
/>
<XDSBanner
status="warning"
title="API key expires soon"
description="Generate a new key before December 1 to avoid service interruption."
endContent={
<XDSButton label="Renew key" variant="secondary" size="sm" />
}
/>
<XDSBanner
status="error"
title="Payment failed"
description="We could not process your last payment."
endContent={<XDSButton label="Retry" variant="secondary" size="sm" />}
/>
</XDSStack>
);
}
Banner — CollapsibleCombine an action button, dismiss control, and expandable detail area in one banner. Use for complex notifications like config changes or deployment summaries.
tsx
'use client';
​
import {XDSBanner} from '@xds/core/Banner';
import {XDSButton} from '@xds/core/Button';
import {XDSList, XDSListItem} from '@xds/core/List';
import {XDSStack} from '@xds/core/Layout';
import {XDSText} from '@xds/core/Text';
​
export default function BannerCollapsibleContent() {
return (
<XDSBanner
status="warning"
title="Configuration changes detected"
description="Review the changes before they take effect."
endContent={<XDSButton label="Review" variant="secondary" size="sm" />}
isDismissable
defaultIsExpanded>
<XDSStack direction="vertical" gap={2}>
<XDSText type="supporting" color="secondary">
Changed settings:
</XDSText>
<XDSList density="compact">
<XDSListItem label="Authentication method updated" />
<XDSListItem label="Rate limits modified" />
</XDSList>
</XDSStack>
</XDSBanner>
);
}
Banner — DismissLet the user close a banner after reading it. Use for maintenance notices, feature tips, or any non-critical message the user can acknowledge.
tsx
'use client';
​
import {XDSBanner} from '@xds/core/Banner';
import {XDSStack} from '@xds/core/Layout';
​
export default function BannerDismissable() {
return (
<XDSStack direction="vertical" gap={3}>
<XDSBanner
status="success"
title="Deployment complete"
description="Version 3.2.0 is now live in production."
isDismissable
/>
<XDSBanner
status="warning"
title="Scheduled maintenance tonight"
description="The system will be briefly unavailable from 2:00–3:00 AM."
isDismissable
/>
<XDSBanner
status="info"
title="New feature available"
description="Try the new dashboard layout in Settings."
isDismissable
/>
</XDSStack>
);
}
Banner — Full WidthA full-width banner with no border radius for page-level notifications. Use at the top of a page for site-wide announcements or maintenance alerts.
tsx
'use client';
​
import {XDSBanner} from '@xds/core/Banner';
import {XDSButton} from '@xds/core/Button';
import {XDSStack} from '@xds/core/Layout';
​
export default function BannerSectionVariant() {
return (
<XDSStack direction="vertical" gap={3}>
<XDSBanner
status="warning"
title="Scheduled downtime"
description="All services will be unavailable on Sunday from 2:00–4:00 AM."
container="section"
isDismissable
/>
<XDSBanner
status="info"
title="Welcome to the new dashboard"
description="We have redesigned the layout based on your feedback."
container="section"
endContent={
<XDSButton label="Take a tour" variant="secondary" size="sm" />
}
/>
</XDSStack>
);
}
Banner — StatusesAll 4 banner statuses: info, success, warning, and error. Use to show persistent messages like updates, confirmations, cautions, or problems at the top of a page or section.
tsx
'use client';
​
import {XDSBanner} from '@xds/core/Banner';
import {XDSStack} from '@xds/core/Layout';
​
export default function BannerStatuses() {
return (
<XDSStack direction="vertical" gap={3}>
<XDSBanner
status="info"
title="A new software update is available"
description="Version 2.4.1 includes performance improvements and bug fixes."
/>
<XDSBanner
status="success"
title="Changes saved"
description="Your profile information has been updated successfully."
/>
<XDSBanner
status="warning"
title="Storage almost full"
description="You have used 90% of your available storage."
/>
<XDSBanner
status="error"
title="Build failed"
description="3 tests did not pass. Check the logs for details."
/>
</XDSStack>
);
}

Showcase source

tsx
'use client';
​
import {XDSBanner} from '@xds/core/Banner';
import {XDSStack} from '@xds/core/Layout';
import * as stylex from '@stylexjs/stylex';
​
const styles = stylex.create({
root: {
maxWidth: 800,
},
});
​
export default function BannerShowcase() {
return (
<XDSStack direction="vertical" gap={3} xstyle={styles.root}>
<XDSBanner status="info" title="A new software update is available." />
<XDSBanner status="success" title="Your changes have been saved." />
<XDSBanner
status="warning"
title="Your trial expires in 3 days."
description="Upgrade to keep access to all features."
/>
<XDSBanner
status="error"
title="Payment failed."
description="Update your billing information to continue."
/>
</XDSStack>
);
}