diff --git a/packages/components/src/components/callout/callout.stories.tsx b/packages/components/src/components/callout/callout.stories.tsx index 14f1d8c2..ccab5548 100644 --- a/packages/components/src/components/callout/callout.stories.tsx +++ b/packages/components/src/components/callout/callout.stories.tsx @@ -14,6 +14,10 @@ const meta: Meta = { options: ["info", "warning", "note", "tip", "check", "danger", "custom"], description: "Predefined callout variant", }, + title: { + control: "text", + description: "Optional title displayed above the callout content", + }, icon: { control: "text", description: "Icon name or custom React node (for custom variant)", @@ -312,3 +316,11 @@ export const BackwardCompatibilityAllTypes: Story = { ), }; + +export const WithTitle: Story = { + args: { + variant: "note", + title: "Authentication", + children:

You must provide an API key.

, + }, +}; diff --git a/packages/components/src/components/callout/callout.tsx b/packages/components/src/components/callout/callout.tsx index ca368a39..ae122844 100644 --- a/packages/components/src/components/callout/callout.tsx +++ b/packages/components/src/components/callout/callout.tsx @@ -24,6 +24,7 @@ type CalloutVariant = type CalloutProps = { children: ReactNode; + title?: string; variant?: CalloutVariant; icon?: ReactNode | string; iconType?: IconType; @@ -80,6 +81,7 @@ const variantConfig = { const Callout = ({ children, + title, variant = "custom", icon, iconType, @@ -181,11 +183,20 @@ const Callout = ({
:nth-child(2)]:mt-3", childrenClassName )} data-component-part="callout-content" style={customTextStyle} > + {title && ( +
+ {title} +
+ )} {children}