// Callout — coloured note box for docs content. Four variants matching
// the Fumadocs/Docusaurus convention: info (default), tip, warning,
// danger. Uses semantic CSS tokens so dark/light both work without
// per-variant overrides in app code.
//
// Usage:
//
// This API is still pre-release. Names + shape can change.
//
import type { ReactNode } from 'react'
import { cn } from '../cn'
type CalloutType = 'info' | 'tip' | 'warning' | 'danger' | 'note'
interface CalloutProps {
readonly type?: CalloutType
readonly title?: ReactNode
readonly children: ReactNode
readonly className?: string
}
const styles: Record = {
info: {
ring: 'border-info/30 bg-info/5 text-info',
icon: 'text-info',
iconPath: (
<>
>
),
},
tip: {
ring: 'border-success/30 bg-success/5 text-success',
icon: 'text-success',
iconPath: (
<>
>
),
},
warning: {
ring: 'border-warning/30 bg-warning/5 text-warning',
icon: 'text-warning',
iconPath: (
<>
>
),
},
danger: {
ring: 'border-destructive/40 bg-destructive/5 text-destructive',
icon: 'text-destructive',
iconPath: (
<>
>
),
},
note: {
ring: 'border-border bg-card/40 text-muted-foreground',
icon: 'text-muted-foreground',
iconPath: (
<>
>
),
},
}
export const Callout = ({
type = 'info', title, children, className,
}: CalloutProps): ReactNode => {
const s = styles[type]
return (
{title ? (
{title}
) : null}
{children}
)
}