Alerta
Os alertas são usados para comunicar um estado ou feedback aos usuários. Frequentemente indicam sucesso, informação, aviso ou erros.
A prop color é usada para definir o nível de severidade do alerta.
import React from "react";import { Alert } from "@firecms/ui";
export default function AlertColorDemo() { return ( <div className="space-y-4 w-full"> <Alert color={"base"}> This is a simple alert. </Alert> <Alert color="error"> This is an error alert. </Alert> <Alert color="warning"> This is a warning alert. </Alert> <Alert color="info"> This is an info alert. </Alert> <Alert color="success"> This is a success alert. </Alert> </div> );}Tamanho
Seção intitulada “Tamanho”A prop size é usada para definir o tamanho do alerta.
import React from "react";import { Alert } from "@firecms/ui";
export default function AlertSieDemo() { return ( <div className="w-full space-y-4"> <Alert size="small"> This is an small alert. </Alert> <Alert size="medium"> This is a medium alert. </Alert> <Alert size="large"> This is a large alert. </Alert> </div> );}Dispensável
Seção intitulada “Dispensável”Os alertas podem ser dispensáveis quando recebem a função de callback onDismiss.
import React, { useState } from "react";import { Alert } from "@firecms/ui";
export default function DismissableAlertDemo() { const [visible, setVisible] = useState(true); return ( <> {visible && ( <Alert onDismiss={() => setVisible(false)} color="info"> This alert can be dismissed with the close button. </Alert> )} </> );}Botão de ação
Seção intitulada “Botão de ação”Inclua um elemento interativo dentro do alerta usando a prop action.
import React from "react";import { Alert, Button } from "@firecms/ui";
export default function AlertActionButtonDemo() { return ( <Alert color="success" action={<Button size="small">Undo</Button>} > This alert contains an action button. </Alert> );}Estilo personalizado
Seção intitulada “Estilo personalizado”Passe classes CSS ou estilos personalizados com as props className e style para personalizar o alerta.
import React from "react";import { Alert } from "@firecms/ui";
export default function CustomStyleAlertDemo() { return ( <Alert outerClassName="custom-class" style={{ borderLeft: "4px solid #4ade80", color: "#fff", background: "repeating-linear-gradient(45deg,#606dbc,#606dbc 10px,#465298 10px,#465298 20px)" }} color="success" > This alert has custom styling. </Alert> );}