Alert #

Alert messages are used for user interaction.

import { PAlert } from 'pearkit';

Basic #

Here is an alert component that you can use in your projects.

Lorem Ipsum is simply dummy text of the printing
const [alertStatus, setAlertStatus] = useState(false);

<PAlert status={alertStatus} close={() => setAlertStatus(false)} message="Lorem Ipsum..."/>

Types #

Alert comes in 4 different types. info comes by default. The other three are danger, warning and success types.

Lorem Ipsum is simply dummy text of the printing
Lorem Ipsum is simply dummy text of the printing
Lorem Ipsum is simply dummy text of the printing
Lorem Ipsum is simply dummy text of the printing
<PAlert type="success" />

Closable #

Thanks to the closable feature, you can control whether the alert can be closed. You can use it to show fixed message.

Lorem Ipsum is simply dummy text of the printing
<PAlert status={true} closable={false} />

Lifetime #

Here, we can enable the alert component to be closed automatically with the lifetime feature. However, since the state is outside, it still needs the close and status props. Because the lifetime feature triggers the close feature of the component. It also controls the closable feature.

<PAlert lifetime={3000} status={alertStatus} close={() => setAlertStatus(false)} />

Accessibility (Not Ready Yet) #

None

Api #

Here you can see all the working features for the alert component.

NameTypeDefaultDescription
typeAlertType | success | info | danger | warninginfoType of the component
statusboolean | true | falsefalseStatus state of the component
messagestringnullMessage of the component
closefunctionvoidClose function of the component
closableboolean | true | falsetrueClosable status state of the component
lifetimenumberundefinedLifetime property of the component