Alert

The Alert component displays important messages to users with different severity levels, variants, and optional actions like dismissal. Title and body each accept full <Text> props via titleProps / bodyProps. Notice is kept as a deprecated alias of Alert.

Basics

Use sev to set the severity — it picks the matching color and icon automatically.

Loading demo…

import

 

{

 

Alert

,

 

Block

 

}

 

from

 

'@platform-blocks/ui'

;

 

export

 

default

 

function

 

Demo

(

)

 

{

  

return

 

(

    

<Block

>

      

<Alert

 

sev

=

"info"

 

title

=

"Heads up"

>

        

Use

alerts to highlight contextual information inline with page content

.

      

</Alert

>

      

<Alert

 

sev

=

"success"

 

title

=

"Profile saved"

>

        

Your

changes were stored successfully

.

      

</Alert

>

      

<Alert

 

sev

=

"error"

 

title

=

"Connection issue"

>

        

Retry

the action or check the status page

for

outages

.

      

</Alert

>

    

</Block

>

  

)

;

}

Variants

Compare light, outline, filled, and subtle variants to match alert prominence to the message.

Loading demo…

import

 

{

 

Alert

,

 

Block

 

}

 

from

 

'@platform-blocks/ui'

;

 

export

 

default

 

function

 

Demo

(

)

 

{

  

return

 

(

    

<Block

>

      

<Alert

 

variant

=

"light"

 

color

=

"primary"

 

title

=

"Light"

>

        

Balanced

background and border treatment

for

inline notes

.

      

</Alert

>

      

<Alert

 

variant

=

"outline"

 

color

=

"success"

 

title

=

"Outline"

>

        

Subtle

emphasis without increasing background contrast

.

      

</Alert

>

      

<Alert

 

variant

=

"filled"

 

color

=

"warning"

 

title

=

"Filled"

>

        

High

-

contrast option

for

urgent messaging

.

      

</Alert

>

      

<Alert

 

variant

=

"subtle"

 

color

=

"error"

 

title

=

"Subtle"

>

        

No

background color

,

but tinted icon and text

.

      

</Alert

>

    

</Block

>

  

)

;

}

Dismissible

Add withCloseButton and handle onClose to let users dismiss an alert.

Loading demo…

import

 

{

useState

}

 

from

 

'react'

;

import

 

{

 

Alert

,

 

Button

 

}

 

from

 

'@platform-blocks/ui'

;

 

export

 

default

 

function

 

Demo

(

)

 

{

  

const

 

[

visible

,

setVisible

]

 

=

 

useState

(

true

)

;

 

  

if

 

(

!

visible

)

 

{

    

return

 

(

      

<Button

 

variant

=

"outline"

 

onPress

=

{

(

)

 

=>

 

setVisible

(

true

)

}

>

        

Show

alert

      

</Button

>

    

)

;

  

}

 

  

return

 

(

    

<Alert

      

sev

=

"warning"

      

title

=

"Draft warning"

      withCloseButton

      

onClose

=

{

(

)

 

=>

 

setVisible

(

false

)

}

    

>

      

Your

draft is missing a title

.

 

Resolve

before publishing

.

    

</Alert

>

  

)

;

}

Platform Blocks

A comprehensive React Native design system with components that work seamlessly across iOS, Android, and Web.