diff --git a/.changeset/new-cougars-collect.md b/.changeset/new-cougars-collect.md
new file mode 100644
index 0000000000..292c420571
--- /dev/null
+++ b/.changeset/new-cougars-collect.md
@@ -0,0 +1,6 @@
+---
+"@nextui-org/alert": patch
+"@nextui-org/theme": patch
+---
+
+Alert styles improved
diff --git a/apps/docs/content/components/alert/controlled.ts b/apps/docs/content/components/alert/controlled.ts
index 3a4780f3e2..33af02947f 100644
--- a/apps/docs/content/components/alert/controlled.ts
+++ b/apps/docs/content/components/alert/controlled.ts
@@ -13,6 +13,8 @@ export default function App() {
title={title}
description={description}
isVisible={isVisible}
+ variant="faded"
+ color="success"
onClose={() => setIsVisible(false)}
/>
) : (
diff --git a/apps/docs/content/components/alert/custom-styles.ts b/apps/docs/content/components/alert/custom-styles.ts
index b2c5fb17d3..5a9aeb1af0 100644
--- a/apps/docs/content/components/alert/custom-styles.ts
+++ b/apps/docs/content/components/alert/custom-styles.ts
@@ -1,27 +1,54 @@
-const App = `import {Alert} from "@nextui-org/react";
+const App = `import {Alert, Button} from "@nextui-org/react";
export default function App() {
- const title = "Success";
- const description = "Thanks for subscribing to our newsletter!";
-
+ const [isVisible, setIsVisible] = React.useState(true);
+
return (
+ {!isVisible && (
+
+ )}
+ isVisible={isVisible}
+ title="The documents you requested are ready to be viewed"
+ variant="faded"
+ onClose={() => setIsVisible(false)}
+ >
+
+
+
+
+
);
}`;
diff --git a/apps/docs/content/components/alert/index.ts b/apps/docs/content/components/alert/index.ts
index 1be9439d70..7fc0ee5ca4 100644
--- a/apps/docs/content/components/alert/index.ts
+++ b/apps/docs/content/components/alert/index.ts
@@ -5,6 +5,7 @@ import customImpl from "./custom-impl";
import customStyles from "./custom-styles";
import variants from "./variants";
import withIcon from "./with-icon";
+import withAction from "./with-action";
import controlled from "./controlled";
export const alertContent = {
@@ -15,5 +16,6 @@ export const alertContent = {
customStyles,
variants,
withIcon,
+ withAction,
controlled,
};
diff --git a/apps/docs/content/components/alert/variants.ts b/apps/docs/content/components/alert/variants.ts
index 637553b085..48f57385c7 100644
--- a/apps/docs/content/components/alert/variants.ts
+++ b/apps/docs/content/components/alert/variants.ts
@@ -3,15 +3,9 @@ const App = `import {Alert} from "@nextui-org/react";
export default function App() {
return (
-
- A solid variant alert
-
-
- A bordered variant alert
-
-
- A flat variant alert
-
+ {["solid", "bordered", "flat", "faded"].map((variant) => (
+
+ ))}
);
}`;
diff --git a/apps/docs/content/components/alert/with-action.ts b/apps/docs/content/components/alert/with-action.ts
new file mode 100644
index 0000000000..b4f9665f62
--- /dev/null
+++ b/apps/docs/content/components/alert/with-action.ts
@@ -0,0 +1,29 @@
+const App = `import {Alert, Button} from "@nextui-org/react";
+
+export default function App() {
+ const [isVisible, setIsVisible] = React.useState(true);
+
+ return (
+
+
+ Upgrade
+
+ }
+ title="You have no credits left"
+ variant="faded"
+ />
+
+ );
+}`;
+
+const react = {
+ "/App.jsx": App,
+};
+
+export default {
+ ...react,
+};
diff --git a/apps/docs/content/docs/components/alert.mdx b/apps/docs/content/docs/components/alert.mdx
index 3d2b30bc8f..08d7bd3bbe 100644
--- a/apps/docs/content/docs/components/alert.mdx
+++ b/apps/docs/content/docs/components/alert.mdx
@@ -59,7 +59,11 @@ Alert comes with 6 color variants to convey different meanings.
By default, Alert displays an appropriate icon based on the `color` prop. You can override this by providing a custom icon using the `icon` prop.
-
+### With Action
+
+Alert supports an `endContent` prop for additional actions.
+
+
### Controlled Visibility
@@ -92,6 +96,18 @@ Alert has the following attributes on the `base` element:
+### Slots
+
+Alert has the following slots:
+
+- `base`: The main alert container element
+- `title`: The title element
+- `description`: The description element
+- `mainWrapper`: The wrapper for the title and description content
+- `closeButton`: The close button element
+- `iconWrapper`: The wrapper for the alert icon
+- `alertIcon`: The alert icon element
+
## Accessibility
- Alert has role of `alert`
@@ -112,6 +128,8 @@ Alert has the following attributes on the `base` element:
| color | `default` \| `primary` \| `secondary` \| `success` \| `warning` \| `danger` | The alert color theme | `default` |
| variant | `solid` \| `bordered` \| `flat` \| `faded` | The alert variant | `flat` |
| radius | `none` \| `sm` \| `md` \| `lg` \| `full` | The alert border radius | `md` |
+| startContent | `ReactNode` | The alert start content | - |
+| endContent | `ReactNode` | The alert end content | - |
| isVisible | `boolean` | Whether the alert is visible | - |
| isClosable | `boolean` | Whether the alert can be closed | `false` |
| hideIcon | `boolean` | Whether the icon is hidden | `false` |
diff --git a/packages/components/alert/package.json b/packages/components/alert/package.json
index 7dec7b453c..0e4283c81b 100644
--- a/packages/components/alert/package.json
+++ b/packages/components/alert/package.json
@@ -47,9 +47,9 @@
"@nextui-org/react-utils": "workspace:*",
"@nextui-org/shared-icons": "workspace:*",
"@nextui-org/shared-utils": "workspace:*",
+ "@nextui-org/button": "workspace:*",
"@react-stately/utils": "3.10.1",
- "@react-aria/utils": "3.24.1",
- "@nextui-org/button": "workspace:*"
+ "@react-aria/utils": "3.24.1"
},
"devDependencies": {
"@nextui-org/system": "workspace:*",
diff --git a/packages/components/alert/src/alert.tsx b/packages/components/alert/src/alert.tsx
index d6460aa45d..384ed1d0fb 100644
--- a/packages/components/alert/src/alert.tsx
+++ b/packages/components/alert/src/alert.tsx
@@ -32,7 +32,10 @@ const Alert = forwardRef<"div", AlertProps>((props, ref) => {
const {
title,
icon,
+ children,
description,
+ endContent,
+ startContent,
isClosable,
domRef,
handleClose,
@@ -56,14 +59,16 @@ const Alert = forwardRef<"div", AlertProps>((props, ref) => {
return (
+ {startContent}
{customIcon || }
{title &&
{title}
}
{!isEmpty(description) &&
{description}
}
+ {children}
-
+ {endContent}
{(isClosable || onClose) && (