I'd imagine a reusable React component something like:
<Alert type="danger">
Are you sure?
</Alert>
Of course this solution would work in other templating engines as well.
The alternative would be extracting css components:
.alert {
@apply px-4 py-3 ...
}
.alert-danger {
@apply bg-red-100 ..
}