-
- {title ? (
- hideTitle ? (
-
+
+
+ {icon && supportsCustomIcon ? icon : iconForVariant[variant]}
+
+
+ {title ? (
+ hideTitle ? (
+
+ {title}
+
+ ) : (
{title}
-
- ) : (
- {title}
- )
- ) : null}
- {description ? {description} : null}
- {children}
+ )
+ ) : null}
+ {description ? {description} : null}
+ {children}
+
+ {hasActions ?
: null}
- {hasActions ? : null}
-
- {dismissible ? (
-
- ) : null}
-
+ {dismissible ? (
+
+ ) : null}
+
+
)
})
@@ -192,9 +194,12 @@ export type BannerTitleProps
= {
} & React.ComponentPropsWithoutRef
export function BannerTitle(props: BannerTitleProps) {
- const {as: Heading = 'h2', className, children, ...rest} = props
+ const {as: Heading = 'h2', className, children, id, ...rest} = props
+ const context = React.useContext(BannerContext)
+ const titleId = id ?? context?.titleId
+
return (
-
+
{children}
)