Callouts are attention-grabbing components designed to highlight important information, alerts, or messages to users. They serve as visual cues to draw attention to critical content that requires immediate notice or action. Callouts help create a clear information hierarchy and improve user experience by making important messages stand out from regular content.
✅ Use callouts when:
- Displaying system status messages (success, error, warning states)
- Highlighting important announcements or updates
- Showing validation feedback in forms
- Providing contextual help or tips
- Alerting users to temporary system maintenance or issues
- Emphasizing key information that affects user workflow
- Displaying promotional messages or feature highlights
- Showing progress updates in multi-step processes
❌ Don't use callouts for:
- Regular content that doesn't require special attention
- Long-form text or detailed explanations (use cards or content sections instead)
- Navigation elements (use navigation components)
- Content that appears frequently (may cause alert fatigue)
- Decorative purposes without functional meaning
- Replacing proper error handling in forms
A simple callout with a title and message content. The default variant is brand:
Callouts use different variants to convey meaning and importance through color coding. Each variant includes an appropriate default icon:
Control the visual prominence of callouts using different background shades. Use subtle for less prominent messages and strong for high-priority alerts:
Choose between horizontal and vertical layouts based on your content and space requirements. Horizontal alignment is more compact, while vertical alignment provides better readability for longer messages:
Add visual separation and definition by enabling borders. Borders help distinguish callouts from surrounding content:
Make callouts dismissible by adding a close button. Users can press Escape key or click the close button. Handle the dds-close event to implement custom close behavior:
// Listen for the close event
document.querySelector('dap-ds-callout').addEventListener('dds-close', (event) => {
// Hide the callout
event.target.setAttribute('opened', 'false');
// Optional: Remove from DOM after animation
setTimeout(() => {
event.target.remove();
}, 300);
console.log('Callout was dismissed');
});
Override the default variant icons with custom icons using the icon slot. This is useful for brand-specific messaging or specialized use cases:
Fine-tune the visual appearance of callouts with CSS custom properties and exposed shadow parts. Tweak padding, spacing, icon sizes, or add accent borders without recreating the component from scratch.
Use inline styles or global stylesheets to override the built-in design tokens:
Experiment with CSS parts such as base, content, icon, title, description, actions, and close to create bespoke layouts. Try the presets below or craft your own styles in the live editor:
Use the Live CSS Editor to explore the available CSS parts and properties.
Use callouts to provide clear feedback about form validation errors or success states:
Communicate system-wide information and scheduled maintenance:
Examples specific to government and public service contexts:
Callouts are designed with accessibility in mind and include several built-in features:
- Semantic structure: Uses proper ARIA attributes (
role="region",aria-live="polite") - Screen reader support: Automatically announces content changes with
aria-live - Keyboard navigation: Full keyboard support including Escape key to close dismissible callouts
- Focus management: Proper focus handling for interactive elements
- High contrast support: Works with system high contrast modes
- Meaningful icons: Icons include
aria-hidden="true"to prevent screen reader duplication
<!-- Always provide meaningful titles -->
<dap-ds-callout title="Form Submission Error" variant="negative">
Please correct the errors below before resubmitting.
</dap-ds-callout>
<!-- Use clear, actionable language -->
<dap-ds-callout title="Session Timeout Warning" variant="warning" closeable>
Your session will expire in 5 minutes. Click "Extend Session" to continue working.
<dap-ds-button slot="actions">Extend Session</dap-ds-button>
</dap-ds-callout>
<!-- Provide custom close button labels when needed -->
<dap-ds-callout
closeable
closeButtonLabel="Dismiss notification"
title="Update Available">
A new version is available for download.
</dap-ds-callout>
import { DapDSCallout } from 'dap-design-system'
import { DapDSCalloutReact } from 'dap-design-system/react'
For optimal bundle sizes, use the tree-shakeable import syntax:
import { DapDSCallout } from 'dap-design-system/components'
| Property | Type | Default | Description |
|---|---|---|---|
variant | 'brand', 'positive' , 'info' , 'warning' , 'negative' | 'brand' | The variant of the callout |
alignment | 'vertical', 'horizontal' | 'horizontal' | The alignment of the callout. Can be vertical or horizontal. |
shade | 'subtle', 'base' , 'medium' , 'strong' | 'base' | The strongness of the callout colors. Can be subtle, base, medium, or strong. |
noBorder | string | 'true' | If the callout has a border |
closeable | boolean | false | If the callout has a close button |
title | string | The header of the callout | |
closeButtonLabel | string | The label of the close button | |
opened | string | 'true' | If the callout is opened |
| Name | Description |
|---|---|
(default) | The content of the callout. |
title | The title of the callout. |
icon | The icon of the callout. |
actions | The actions of the callout. |
close | The close button of the callout. |
| Event Name | Description | Type |
|---|---|---|
dds-close | Fired when the close button is clicked. | {void } |
| Part Name | Description |
|---|---|
base | The main callout container. |
content | The content of the callout. |
card-content | The content of the card. |
icon | The icon of the callout. |
title | The title of the callout. |
description | The description of the callout. |
actions | The actions of the callout. |
close | The close button of the callout. |
You can style CSS parts using the ::part() pseudo-element selector:
/* Target a specific part */
.my-custom-dap-ds-callout::part(base) {
/* Your custom styles */
}
/* Target multiple parts */
.my-custom-dap-ds-callout::part(base),
.my-custom-dap-ds-callout::part(content) {
/* Shared styles */
}
Example usage:
<dap-ds-callout class="my-custom-dap-ds-callout">
Callout
</dap-ds-callout>
.my-custom-dap-ds-callout::part(base) {
border-radius: 12px;
box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}
CSS parts allow you to style internal elements of the component while maintaining encapsulation. Learn more in our styling guide.
| Property Name | Description |
|---|---|
--dds-callout-padding | Padding of the callout content. (default: var(--dds-spacing-300)) |
--dds-callout-gap | Gap between elements in horizontal layout. (default: var(--dds-spacing-300)) |
--dds-callout-icon-size | Size of the icon. (default: var(--dds-spacing-600)) |
--dds-callout-title-color | Color of the title text. (default: var(--dds-text-neutral-strong)) |
--dds-callout-description-color | Color of the description text. (default: var(--dds-text-neutral-base)) |
--dds-callout-title-font-size | Font size of the title. (default: var(--dds-font-base)) |
--dds-callout-description-font-size | Font size of the description. (default: var(--dds-font-base)) |
--dds-callout-title-font-weight | Font weight of the title. (default: var(--dds-font-weight-bold)) |
--dds-callout-description-font-weight | Font weight of the description. (default: var(--dds-font-weight-medium)) |
--dds-callout-actions-font-weight | Font weight of the actions. (default: var(--dds-font-weight-bold)) |
--dds-callout-actions-gap | Gap between action items. (default: var(--dds-spacing-400)) |
--dds-callout-content-gap | Gap between content elements. (default: var(--dds-spacing-100)) |
--dds-callout-border-radius | Border radius of the callout. (default: var(--dds-radius-base)) |
--dds-callout-brand-background | Brand variant background color. (default: var(--dds-background-brand-base)) |
--dds-callout-brand-background-subtle | Brand variant subtle background color. (default: var(--dds-background-brand-subtle)) |
--dds-callout-brand-background-medium | Brand variant medium background color. (default: var(--dds-background-brand-medium)) |
--dds-callout-brand-background-strong | Brand variant strong background color. (default: var(--dds-background-brand-strong)) |
--dds-callout-brand-icon | Brand variant icon color. (default: var(--dds-icon-brand-subtle)) |
--dds-callout-brand-border | Brand variant border color. (default: var(--dds-border-brand-subtle)) |
--dds-callout-info-background | Info variant background color. (default: var(--dds-background-informative-base)) |
--dds-callout-info-background-subtle | Info variant subtle background color. (default: var(--dds-background-informative-subtle)) |
--dds-callout-info-background-medium | Info variant medium background color. (default: var(--dds-background-informative-medium)) |
--dds-callout-info-background-strong | Info variant strong background color. (default: var(--dds-background-informative-strong)) |
--dds-callout-info-icon | Info variant icon color. (default: var(--dds-icon-informative-subtle)) |
--dds-callout-info-border | Info variant border color. (default: var(--dds-border-informative-subtle)) |
--dds-callout-positive-background | Positive variant background color. (default: var(--dds-background-positive-base)) |
--dds-callout-positive-background-subtle | Positive variant subtle background color. (default: var(--dds-background-positive-subtle)) |
--dds-callout-positive-background-medium | Positive variant medium background color. (default: var(--dds-background-positive-medium)) |
--dds-callout-positive-background-strong | Positive variant strong background color. (default: var(--dds-background-positive-strong)) |
--dds-callout-positive-icon | Positive variant icon color. (default: var(--dds-icon-positive-subtle)) |
--dds-callout-positive-border | Positive variant border color. (default: var(--dds-border-positive-subtle)) |
--dds-callout-warning-background | Warning variant background color. (default: var(--dds-background-warning-base)) |
--dds-callout-warning-background-subtle | Warning variant subtle background color. (default: var(--dds-background-warning-subtle)) |
--dds-callout-warning-background-medium | Warning variant medium background color. (default: var(--dds-background-warning-medium)) |
--dds-callout-warning-background-strong | Warning variant strong background color. (default: var(--dds-background-warning-strong)) |
--dds-callout-warning-icon | Warning variant icon color. (default: var(--dds-icon-neutral-strong)) |
--dds-callout-warning-border | Warning variant border color. (default: var(--dds-border-warning-subtle)) |
--dds-callout-negative-background | Negative variant background color. (default: var(--dds-background-negative-base)) |
--dds-callout-negative-background-subtle | Negative variant subtle background color. (default: var(--dds-background-negative-subtle)) |
--dds-callout-negative-background-medium | Negative variant medium background color. (default: var(--dds-background-negative-medium)) |
--dds-callout-negative-background-strong | Negative variant strong background color. (default: var(--dds-background-negative-strong)) |
--dds-callout-negative-icon | Negative variant icon color. (default: var(--dds-icon-negative-subtle)) |
--dds-callout-negative-border | Negative variant border color. (default: var(--dds-border-negative-subtle)) |
CSS custom properties (CSS variables) can be set directly on the component or in your stylesheet:
Method 1: Inline styles (Quick customization)
<dap-ds-callout
style="--dds-callout-padding: value; --dds-callout-gap: value;">
Callout
</dap-ds-callout>
Method 2: CSS classes (Reusable styles)
.my-custom-dap-ds-callout {
--dds-callout-padding: value;
--dds-callout-gap: value;
--dds-callout-icon-size: value;
}
<dap-ds-callout class="my-custom-dap-ds-callout">
Callout
</dap-ds-callout>
Method 3: Global theme customization
/* Apply to all instances */
dap-ds-callout {
--dds-callout-padding: value;
--dds-callout-gap: value;
}
CSS custom properties inherit through the Shadow DOM, making them perfect for theming. Changes apply immediately without rebuilding.