salla-alert

Shows a short inline message with an icon, in one of four colour variants.

Shows a short inline message with an icon, in one of four colour variants. Use it for notices inside a page, such as a warning above a form. It has no close button and is not dismissible.

Use it

In HTML or JSX, use the tag <salla-alert> with the Attribute names below. In React, the wrapper takes the Property names (camelCase).

import { SallaAlert } from '@salla.sa/twilight-components-react/alert';

Try it

web-components/salla-alert

Example

import { SallaAlert } from '@salla.sa/twilight-components-react/alert';

export function Example() {
  return (
    <SallaAlert variant="warning" message="Only 2 items left in stock" />
  );
}
import { SallaAlert } from '@salla.sa/twilight-components-react/alert';

export function Example() {
  return (
    <SallaAlert variant="success" icon="none">Your changes were saved</SallaAlert>
  );
}

Properties

PropertyAttributeDescriptionTypeDefault
iconiconIcon to show: info, success, warning or error. Use none to hide the icon. Defaults to the icon matching variant."error" | "info" | "none" | "success" | "warning"
messagemessageText of the alert. Content placed inside the element is shown after it.string
variantvariantColour style of the alert: info, success, warning or error. Also used as the icon when icon is not set."error" | "info" | "success" | "warning"'info'

Slots

SlotDescription
(default)Extra content shown after message, in the same text area.

On this page