---
title: useNotice
description: "`useNotice` is a custom hook that controls the notifications of the application."
links:
- source: https://github.com/yamada-ui/yamada-ui/tree/main/packages/react/src/hooks/use-notice
- storybook: https://yamada-ui.github.io/yamada-ui?path=/story/hooks-usenotice--basic
---
```tsx
const notice = useNotice()
return (
)
```
## Usage
```tsx
import { useNotice } from "@yamada-ui/react"
```
```tsx
import { useNotice } from "@/components/ui"
```
```tsx
import { useNotice } from "@workspaces/ui"
```
```tsx
const notice = useNotice()
```
### Change Variant
```tsx
const notice = useNotice()
return (
{(variant) => (
)}
)
```
### Change Color Scheme
```tsx
const notice = useNotice()
return (
{(colorScheme) => (
)}
)
```
### Change Loading Scheme
```tsx
const notice = useNotice()
return (
{(loadingScheme) => (
)}
)
```
### Change Status
To change the status, set the `status` to `"info"` or `"success"` etc.
```tsx
const notice = useNotice()
return (
{(status) => (
)}
)
```
### Change Limit
To change the limit, set the `limit` to a number.
```tsx
const notice = useNotice({ limit: 10 })
return (
)
```
### Change Duration
To change the duration, set the `duration` to a number.
```tsx
const notice = useNotice({ duration: 10000 })
return (
)
```
### Keep Stay
To keep the notice staying, set the `duration` to `null`.
```tsx
const notice = useNotice({ duration: null })
return (
)
```
### Change Placement
To change the placement, set the `placement` to `"start"` or `"end"` etc.
```tsx
const notice = useNotice({ duration: null })
return (
{(placement) => (
)}
)
```
### Change Close Strategy
To change the close strategy, set the `closeStrategy` to `"click"` or `"drag"` etc.
```tsx
const notice = useNotice()
return (
{(closeStrategy) => (
)}
{(closeStrategy) => (
)}
)
```
### Close Notice
To close the notice, use `close` or `closeAll`.
```tsx
const notice = useNotice()
const id = useRef(null)
const onOpen = () => {
id.current = notice({
closable: true,
description: "お前が好きだ。",
duration: 30000,
title: "クラン・クラン",
})
}
const onClose = () => {
if (id.current) notice.close(id.current)
}
const onCloseAll = () => {
notice.closeAll()
}
return (
)
```
### Update Notice
To update the notice, use `update`.
```tsx
const notice = useNotice()
const id = useRef(null)
const onOpen = () => {
id.current = notice({
colorScheme: "orange",
description: "チャンスは目の前にあるものよ。",
duration: 5000,
title: "シェリル・ノーム",
})
}
const onUpdate = () => {
if (id.current)
notice.update(id.current, {
colorScheme: "blue",
description: "人生はワン・ツー・デカルチャー!!頑張れ、私。",
duration: 5000,
title: "ランカ・リー",
})
}
return (
)
```
## Configuration
### Make Notice Always Expand
To make the notice always expand, set the `expand` to `true`.
```tsx
import { UIProvider, extendConfig } from "@yamada-ui/react"
const config = extendConfig({
notice: {
expand: true,
},
})
const App = () => {
return (
)
}
```
### Change Placement
To change the placement, set the `placement` to `"start"` or `"end"` etc.
```tsx
import { UIProvider, extendConfig } from "@yamada-ui/react"
const config = extendConfig({
notice: {
placement: "end-end",,
},
})
const App = () => {
return (
)
}
```
### Change Limit
To change the limit, set the `limit` to a number.
```tsx
import { UIProvider, extendConfig } from "@yamada-ui/react"
const config = extendConfig({
notice: {
limit: 5,
},
})
const App = () => {
return (
)
}
```
### Change Close Strategy
To change the close strategy, set the `closeStrategy` to `"click"` or `"drag"` etc.
```tsx
import { UIProvider, extendConfig } from "@yamada-ui/react"
const config = extendConfig({
notice: {
closeStrategy: "click",
},
})
const App = () => {
return (
)
}
```