Callout API
Import
Section titled “Import”import { Callout } from '@cimpress-ui/react';Dismissing callouts
Section titled “Dismissing callouts”Callouts can optionally be dismissed by the users. To enable this, pass an isDismissible prop to the callout component.
import { Button, Callout, Stack } from '@cimpress-ui/react';import { useState } from 'react';
export default function Demo() { const [isCalloutOpen, setIsCalloutOpen] = useState(false);
return ( <Stack gap={16}> <Button onPress={() => setIsCalloutOpen(true)}>Show dismissible callout</Button>
{isCalloutOpen && ( <Callout tone="info" title="Dismissal example" isDismissible onDismiss={() => setIsCalloutOpen(false)}> This callout can be dismissed. </Callout> )} </Stack> );}Actions
Section titled “Actions”Use the actions prop to render actions within the callout.
import { Button, Callout, LinkButton } from '@cimpress-ui/react';
export default function Demo() { return ( <Callout tone="info" title="Callout with actions" actions={ <> <Button size="small">Primary action</Button> <LinkButton href="#" size="small" variant="tertiary"> Learn more </LinkButton> </> } > This callout contains actions. </Callout> );}API reference
Section titled “API reference”Callout
Section titled “Callout”Displays an inline message banner that highlights important information.
- Ref<HTMLDivElement>
-
The
reftype for this component.
CalloutProps
- ReactNode
children *
Section titled “ children * ” -
The content of the callout.
- 'success' | 'info' | 'warning' | 'critical'
tone *
Section titled “ tone * ” -
The tone of the callout.
- string
title
Section titled “ title ” -
The title of the callout.
- ReactNode
actions
Section titled “ actions ” -
Optional actions to display at the bottom of the callout. Use
ButtonorLinkButtoncomponents only. - boolean
isDismissible
Section titled “ isDismissible ” - Defaults to false .
Whether the callout can be dismissed by the user.
- () => void
onDismiss
Section titled “ onDismiss ” -
Callback function to be called when the dismiss button is pressed. Makes the callout controlled.
- string
-
The element's unique identifier. See MDN.
- boolean
data-cim-style-root
Section titled “ data-cim-style-root ” -
Use this attribute to "claim" the component tree for exclusive Cimpress UI usage.
- string
UNSAFE_className
Section titled “ UNSAFE_className ” -
Sets the CSS className for the element. Only use as a last resort. Use style props instead.
See styling guide.
- CSSProperties
UNSAFE_style
Section titled “ UNSAFE_style ” -
Sets the CSS style for the element. Only use as a last resort. Use style props instead.
See styling guide.
StyleProps
- Responsive<Spacing | "auto">
margin
Section titled “ margin ” -
The amount of margin applied to all edges of this component.
- Responsive<Spacing | "auto">
marginX
Section titled “ marginX ” -
The amount of margin applied to the left and right edges of this component. Takes priority over
margin. - Responsive<Spacing | "auto">
marginY
Section titled “ marginY ” -
The amount of margin applied to the top and bottom edges of this component. Takes priority over
margin. - Responsive<Spacing | "auto">
marginTop
Section titled “ marginTop ” -
The amount of margin applied to the top edge of this component. Takes priority over
marginYandmargin. - Responsive<Spacing | "auto">
marginRight
Section titled “ marginRight ” -
The amount of margin applied to the right edge of this component. Takes priority over
marginXandmargin. - Responsive<Spacing | "auto">
marginBottom
Section titled “ marginBottom ” -
The amount of margin applied to the bottom edge of this component. Takes priority over
marginYandmargin. - Responsive<Spacing | "auto">
marginLeft
Section titled “ marginLeft ” -
The amount of margin applied to the left edge of this component. Takes priority over
marginXandmargin.