Alert
Installation
npm i @snack-uikit/alert
Changelog
Example
import { Alert, AlertTop } from '@snack-uikit/alert';
import { InfoFilledSVG } from '@snack-uikit/icons';
<Alert
appearance='neutral'
link={{
text: 'Link text',
href: 'https://cloud.ru/',
}}
title='Title'
description='Title description'
onClose={() => console.log('alert')}
/>;
<AlertTop
appearance='neutral'
link={{
text: 'Link text',
href: 'https://cloud.ru/',
}}
closeable
title='Title'
description='Title description'
action={{
text: 'Button Text',
icon: <PlaceholderSVG />,
onClick: () => {},
}}
onClose={() => console.log('alert top')}
/>;
Alert
Компонент для отображения уведомления.
Props
| description* | ReactNode | - | Описание |
| icon | boolean | true | Отображать иконку |
| title | string | - | Заголовок |
| truncate | { title?: number; } | '{ title: 1 }' | Максимальное кол-во строк - title - в заголовке |
| link | PickLinkProps<LinkElement, "text" | "appearance" | "as"> | - | Cсылка |
| onClose | () => void | - | Колбек закрытия |
| appearance | enum Appearance: "neutral", "primary", "error", "warning", "success", "info" | neutral | Внешний вид |
| outline | boolean | - | Внешний бордер |
| size | enum Size: "s", "m" | m | Размер |
| className | string | - | CSS-класс |
| actions | { primary: Omit<AlertButtonProps, "appearance">; secondary?: Omit<AlertButtonProps, "appearance">; } | - | Кнопки в футере алерта |
AlertTop
Компонент для отображения уведомления вверху экрана.
Props
| description* | ReactNode | - | Описание |
| icon | boolean | true | Отображать иконку |
| title | string | - | Заголовок |
| truncate | { title?: number; } | '{ title: 1 }' | Максимальное кол-во строк - title - в заголовке |
| link | PickLinkProps<LinkElement, "text" | "appearance" | "as"> | - | Cсылка |
| action | AlertButtonProps | - | Кнопка дополнительного действия |
| onClose | () => void | - | Колбек закрытия |
| appearance | enum Appearance: "neutral", "primary", "error", "warning", "success", "info" | neutral | Внешний вид |
| className | string | - | CSS-класс |