--- title: Alert description: "`Alert` is a component that conveys information to the user." links: - style: https://github.com/yamada-ui/yamada-ui/tree/main/packages/react/src/components/alert/alert.style.ts - source: https://github.com/yamada-ui/yamada-ui/tree/main/packages/react/src/components/alert - storybook: https://yamada-ui.github.io/yamada-ui?path=/story/components-alert--basic --- # Alert `Alert` is a component that conveys information to the user. ```tsx セル か…完全体に………完全体になれさえすれば………!!! ``` ## Usage ```tsx import { Alert } from "@yamada-ui/react" ``` ```tsx import { Alert } from "@/components/ui" ``` ```tsx import { Alert } from "@workspaces/ui" ``` ```tsx ``` :::tip To display popup notifications in response to user actions or API responses, use [useNotice](https://yamada-ui.com/docs/hooks/use-notice.md). ::: :::tip To display notifications as part of a page in response to user actions or API responses, use [Snacks](https://yamada-ui.com/docs/components/snacks.md). ::: ### Change Status ```tsx {(status, index) => ( セル か…完全体に………完全体になれさえすれば………!!! )} ``` ### Change Variant ```tsx {(variant, index) => ( {variant !== "island" && } セル か…完全体に………完全体になれさえすれば………!!! )} ``` ### Change Color Scheme ```tsx {(row, index) => ( セル か…完全体に………完全体になれさえすれば………!!! )} ``` ### Change Loading Scheme ```tsx {(row, index) => ( セル か…完全体に………完全体になれさえすれば………!!! )} ``` ### Customize Layout ```tsx セル か…完全体に………完全体になれさえすれば………!!! セル か…完全体に………完全体になれさえすれば………!!! ``` ## Props ### Alert.Root | Prop | Default | Type | Description | | ------------- | --------- | ------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------ | | `as` | - | `As` | The HTML element to render. | | `asChild` | - | `boolean` | Merges its props onto its immediate child. | | `css` | - | `CSSObject \| CSSObject[]` | The CSS object. | | `colorScheme` | - | `"amber" \| "black" \| "blackAlpha" \| "blue" \| "cyan" \| "danger" \| "emerald" \| "error" \| "flashy" \| "fuchsia" ...` | Set color scheme variables. | | `variant` | `"plain"` | `"island" \| "plain" \| "solid" \| "subtle" \| "surface" ...` | The variant of the component. | | `status` | `"info"` | `StatusScheme` | The status of the alert. | ### Alert.Description | Prop | Default | Type | Description | | ------------- | ------- | ------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------ | | `as` | - | `As` | The HTML element to render. | | `asChild` | - | `boolean` | Merges its props onto its immediate child. | | `css` | - | `CSSObject \| CSSObject[]` | The CSS object. | | `colorScheme` | - | `"amber" \| "black" \| "blackAlpha" \| "blue" \| "cyan" \| "danger" \| "emerald" \| "error" \| "flashy" \| "fuchsia" ...` | Set color scheme variables. | ### Alert.Icon | Prop | Default | Type | Description | | ------------- | ------- | ------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------ | | `as` | - | `As` | The HTML element to render. | | `asChild` | - | `boolean` | Merges its props onto its immediate child. | | `css` | - | `CSSObject \| CSSObject[]` | The CSS object. | | `colorScheme` | - | `"amber" \| "black" \| "blackAlpha" \| "blue" \| "cyan" \| "danger" \| "emerald" \| "error" \| "flashy" \| "fuchsia" ...` | Set color scheme variables. | ### Alert.Loading | Prop | Default | Type | Description | | ---------------- | -------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------ | | `as` | - | `As` | The HTML element to render. | | `asChild` | - | `boolean` | Merges its props onto its immediate child. | | `css` | - | `CSSObject \| CSSObject[]` | The CSS object. | | `colorScheme` | - | `"amber" \| "black" \| "blackAlpha" \| "blue" \| "cyan" \| "danger" \| "emerald" \| "error" \| "flashy" \| "fuchsia" ...` | Set color scheme variables. | | `duration` | - | `IconProps["dur"]` | The CSS `dur` property. | | `loadingScheme` | `"oval"` | `Loading.Scheme` | The loading scheme. | | `secondaryColor` | - | `"-moz-initial" \| "AccentColor" \| "AccentColorText" \| "ActiveBorder" \| "ActiveCaption" \| "ActiveText" \| "aliceblue" \| "amber.100" \| "amber.200" \| "amber.300" ...` | The CSS `color` property. | ### Alert.Title | Prop | Default | Type | Description | | ------------- | ------- | ------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------ | | `as` | - | `As` | The HTML element to render. | | `asChild` | - | `boolean` | Merges its props onto its immediate child. | | `css` | - | `CSSObject \| CSSObject[]` | The CSS object. | | `colorScheme` | - | `"amber" \| "black" \| "blackAlpha" \| "blue" \| "cyan" \| "danger" \| "emerald" \| "error" \| "flashy" \| "fuchsia" ...` | Set color scheme variables. | ## Accessibility `Alert` follows the [WAI-ARIA - Alert Pattern](https://www.w3.org/WAI/ARIA/apg/patterns/alert/) for accessibility. ### ARIA Roles and Attributes | Element | Roles and Attributes | Usage | | -------------------- | -------------------- | ------------------------------ | | `div.ui-alert__root` | `role="alert"` | Indicates that it is an alert. | ## Similar Components - [Snacks](https://yamada-ui.com/docs/components/snacks.md): `Snacks` is a component for controlling notifications used in forms and other similar situations. - [Tip](https://yamada-ui.com/docs/components/tip.md): `Tip` is a component that displays supplementary information with a built-in icon trigger. - [EmptyState](https://yamada-ui.com/docs/components/empty-state.md): `EmptyState` is a component used to display when a resource is empty or unavailable. - [CircleProgress](https://yamada-ui.com/docs/components/circle-progress.md): `CircleProgress` is a component that displays progress in a circular progress bar. - [Progress](https://yamada-ui.com/docs/components/progress.md): `Progress` is a component for visually indicating progress. - [Skeleton](https://yamada-ui.com/docs/components/skeleton.md): `Skeleton` is a component that acts as a placeholder until content is loaded. - [Status](https://yamada-ui.com/docs/components/status.md): `Status` is component that indicate the status of a process or state. ## Uses Components & Hooks - [Icon](https://yamada-ui.com/docs/components/icon.md): `Icon` is a general icon component that can be used in your projects. - [Loading](https://yamada-ui.com/docs/components/loading.md): `Loading` is a component displayed during waiting times, such as when data is being loaded. - [Status](https://yamada-ui.com/docs/components/status.md): `Status` is component that indicate the status of a process or state. ## Used By Components & Hooks - [Snacks](https://yamada-ui.com/docs/components/snacks.md): `Snacks` is a component for controlling notifications used in forms and other similar situations.