logoAnt Design

⌘ K
  • 디자인
  • 개발
  • 컴포넌트
  • 블로그
  • 자료
5.21.3
  • Components Overview
  • General
    • Button
    • FloatButton
      5.0.0
    • Icon
    • Typography
  • Layout
    • Divider
    • Flex
      5.10.0
    • Grid
    • Layout
    • Space
    • Splitter
      5.21.0
  • Navigation
    • Anchor
    • Breadcrumb
    • Dropdown
    • Menu
    • Pagination
    • Steps
  • Data Entry
    • AutoComplete
    • Cascader
    • Checkbox
    • ColorPicker
      5.5.0
    • DatePicker
    • Form
    • Input
    • InputNumber
    • Mentions
    • Radio
    • Rate
    • Select
    • Slider
    • Switch
    • TimePicker
    • Transfer
    • TreeSelect
    • Upload
  • Data Display
    • Avatar
    • Badge
    • Calendar
    • Card
    • Carousel
    • Collapse
    • Descriptions
    • Empty
    • Image
    • List
    • Popover
    • QRCode
      5.1.0
    • Segmented
    • Statistic
    • Table
    • Tabs
    • Tag
    • Timeline
    • Tooltip
    • Tour
      5.0.0
    • Tree
  • Feedback
    • Alert
    • Drawer
    • Message
    • Modal
    • Notification
    • Popconfirm
    • Progress
    • Result
    • Skeleton
    • Spin
    • Watermark
      5.1.0
  • Other
    • Affix
    • App
      5.1.0
    • ConfigProvider
    • Util
      5.13.0

Alert

Display warning messages that require attention.
가져오기import{ Alert }from"antd";
소스components/alert
문서
이 페이지 수정변경 로그

Resources

Ant Design Charts
Ant Design Pro
Ant Design Pro Components
Ant Design Mobile
Ant Design Mini
Ant Design Landing-Landing Templates
Scaffolds-Scaffold Market
Umi-React Application Framework
dumi-Component doc generator
qiankun-Micro-Frontends Framework
ahooks-React Hooks Library
Ant Motion-Motion Solution
China Mirror 🇨🇳

Community

Awesome Ant Design
Medium
Twitter
yuque logoAnt Design in YuQue
Ant Design in Zhihu
Experience Cloud Blog
seeconf logoSEE Conf-Experience Tech Conference
Work with Us

Help

GitHub
Change Log
FAQ
Bug Report
Issues
Discussions
StackOverflow
SegmentFault

Ant XTech logoMore Products

yuque logoYuQue-Document Collaboration Platform
AntV logoAntV-Data Visualization
Egg logoEgg-Enterprise Node.js Framework
Kitchen logoKitchen-Sketch Toolkit
Galacean logoGalacean-Interactive Graphics Solution
xtech logoAnt Financial Experience Tech
Theme Editor
Made with ❤ by
Ant Group and Ant Design Community
开发
设计
loading

When To Use

  • When you need to show alert messages to users.
  • When you need a persistent static container which is closable by user actions.

Examples

API

Common props ref:Common props

PropertyDescriptionTypeDefaultVersion
actionThe action of AlertReactNode-4.9.0
afterCloseCalled when close animation is finished() => void-
bannerWhether to show as bannerbooleanfalse
closableThe config of closable, >=5.15.0: support aria-*boolean | ({ closeIcon?: React.ReactNode } & React.AriaAttributes)false
descriptionAdditional content of AlertReactNode-
iconCustom icon, effective when showIcon is trueReactNode-
messageContent of AlertReactNode-
showIconWhether to show iconbooleanfalse, in banner mode default is true
typeType of Alert styles, options: success, info, warning, errorstringinfo, in banner mode default is warning
onCloseCallback when Alert is closed(e: MouseEvent) => void-

Alert.ErrorBoundary

PropertyDescriptionTypeDefaultVersion
descriptionCustom error description to showReactNode{{ error stack }}
messageCustom error message to showReactNode{{ error }}

Design Token

컴포넌트 토큰어떻게 사용하나요?

토큰 이름설명타입기본값
defaultPadding默认内间距undefined | Padding<string | number>8px 12px
withDescriptionIconSize带有描述时的图标尺寸number24
withDescriptionPadding带有描述的内间距undefined | Padding<string | number>20px 24px

글로벌 토큰어떻게 사용하나요?

Banner
codepen icon
External Link Icon
expand codeexpand code
Basic
codepen icon
External Link Icon
expand codeexpand code
Closable
codepen icon
External Link Icon
expand codeexpand code
Icon
codepen icon
External Link Icon
expand codeexpand code
Loop Banner
codepen icon
External Link Icon
expand codeexpand code
ErrorBoundary
codepen icon
External Link Icon
expand codeexpand code
Custom action
codepen icon
External Link Icon
expand codeexpand code
More types
codepen icon
External Link Icon
expand codeexpand code
Description
codepen icon
External Link Icon
expand codeexpand code
Smoothly Unmount
codepen icon
External Link Icon
expand codeexpand code
Custom Icon
codepen icon
External Link Icon
expand codeexpand code
Component Token
codepen icon
External Link Icon
expand codeexpand code
Success Text
Warning Text Warning Text Warning TextW arning Text Warning Text Warning TextWarning Text

Error Text
Error Description Error Description Error Description Error Description Error Description Error Description

Error Text
Error Description Error Description Error Description Error Description Error Description Error Description
Success Tips

Informational Notes

Warning

Error

Success Tips
Detailed description and advice about successful copywriting.

Informational Notes
Additional description and information about copywriting.

Warning
This is a warning notice about copywriting.

Error
This is an error message about copywriting.
Success Tips

Error Text
Error Description Error Description Error Description Error Description

Warning Text

Info Text
Info Description Info Description Info Description Info Description
Success Text

Info Text

Warning Text

Error Text
Success Text
Success Description Success Description Success Description

Info Text
Info Description Info Description Info Description Info Description

Warning Text
Warning Description Warning Description Warning Description Warning Description

Error Text
Error Description Error Description Error Description Error Description
Alert Message Text

click the close button to see the effect

showIcon = false

Success Tips

Informational Notes

Warning

Error

Success Tips
Detailed description and advice about successful copywriting.

Informational Notes
Additional description and information about copywriting.

Warning
This is a warning notice about copywriting.

Error
This is an error message about copywriting.
Success Tips
Detailed description and advice about successful copywriting.