Alert
Alert component for displaying important messages to users.
Show code Hide code
import { Alert, Button } from '@mylighthouse/prism-react';
import { useState } from 'react';
export default function BasicExample(): React.ReactElement {
const [open, setOpen] = useState(false);
return (
<>
<Button onClick={() => setOpen(true)}>Open Alert</Button>
<Alert onOpenChange={setOpen} open={open}>
<Alert.Illustration name="100x100_info" />
<Alert.Title>This is an alert title</Alert.Title>
<Alert.Text>This is the alert text providing more details.</Alert.Text>
<Alert.Footer>
<Alert.Button onClick={() => setOpen(false)} type="secondary">
Cancel
</Alert.Button>
<Alert.Button onClick={() => setOpen(false)} type="primary">
Confirm
</Alert.Button>
</Alert.Footer>
</Alert>
</>
);
} Alert
| Name | Default | Type | Description |
|---|---|---|---|
open * | -- | boolean | -- |
onOpenChange | -- | (open: boolean) => void | -- |
Alert.Illustration
| Name | Default | Type | Description |
|---|---|---|---|
name * | -- | IllustrationName | -- |
Alert.Title
No component-specific props
Alert.Text
No component-specific props
Alert.Footer
No component-specific props
Alert.Button
| Name | Default | Type | Description |
|---|---|---|---|
onClick * | -- | () => void | -- |
type * | -- | "primary" | "secondary" | "critical" | "critical-secondary" | "warning" | "success" | "intelligence" | "intelligence-secondary" | "brand" | "ghost" | "unstyled" | -- |
className | -- | string | -- |