Skip to content

Alert

A React source recipe composed with native elements and the public TIS Alert classes and tokens.

Design

Functional preview

Running with the React source recipe distributed through shadcn and based on Base UI.

Loading functional preview…

Anatomy

1 2 3 4 5 6
1 Container (.ds-alert) — background, border-radius, padding.
2 Icon (.ds-alert__icon) — type-specific Lucide icon, reinforces meaning beyond color.
3 Content (.ds-alert__content) — wrapper for title and description.
4 Title (.ds-alert__title) — bold, 1-3 words.
5 Description (.ds-alert__description) — what happened + what to do.
6 Close (.ds-alert__close) — dismiss button with aria-label="Dismiss alert".

Solid Variants

Subtle Variants

With Close Button

With actions

Actions are optional and compose up to two Small Ghost Buttons inside the Alert content.

Token mapping

Tokens shown for the success variant. Other types (warning, error, info) follow the same pattern with their respective feedback color groups.

PropertyTokenCSS variable
bg (success solid)component.alert.bg.success.solid--ds-alert-bg-success-solid
bg (success subtle)component.alert.bg.success.subtle--ds-alert-bg-success-subtle
border (success subtle)component.alert.border-color.success.subtle--ds-alert-border-color-success-subtle
text (success solid)component.alert.description.color.success.solid--ds-alert-description-color-success-solid
text title (subtle)component.alert.title.color.subtle--ds-alert-title-color-subtle
text description (subtle)component.alert.description.color.subtle--ds-alert-description-color-subtle
root paddingcomponent.alert.padding.default--ds-alert-padding-default
root gapcomponent.alert.gap.default--ds-alert-gap-default
root radiuscomponent.alert.radius.default--ds-alert-radius-default
root border-widthcomponent.alert.border-width.default--ds-alert-border-width-default
icon sizecomponent.alert.icon.size.default--ds-alert-icon-size-default
content gapcomponent.alert.content.gap.default--ds-alert-content-gap-default
title typographycomponent.alert.title.*.default--ds-alert-title-*-default
description typographycomponent.alert.description.*.default--ds-alert-description-*-default
close icon sizecomponent.alert.close.icon-size.default--ds-alert-close-icon-size-default
close target sizecomponent.alert.close.size.default--ds-alert-close-size-default
actions layoutcomponent.alert.actions.{gap|padding-top}.default--ds-alert-actions-*
action colorcomponent.alert.action.color.*--ds-alert-action-color-*