📝 [RFC] Support closable prop in closable component #42828
kiner-tang
announced in
RFCs - archive
Replies: 3 comments 8 replies
-
FloatButton 没有 closable 吧 |
Beta Was this translation helpful? Give feedback.
3 replies
-
closeIcon 应该收到 |
Beta Was this translation helpful? Give feedback.
5 replies
-
文档中隐藏 closable, closeIcon 支持 |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Summary
Support pass
null
andfalse
into closeIcon to hide close icon in closable component.Remove the documentation description of "closable" as this usage is no longer recommended and 'closeIcon' is recommended instead.
Motivation
As #42736 mentioned.
At present, there are many closable components, support the custom close button configured by
closeIcon
, and support theclosable
property to control whether the close button is displayed. This design is somewhat redundant. We can do exactly the same thing by settingcloseIcon
to null or false.Here is a list of components we need to optimize:
All of closable components should be optimized as follows:
closeIcon
support passnull
andboolean
to control whether the close button is displayed. And remove the document aboutclosable
if existed.In addition to the above uniform optimizations, each component may need to do some additional optimizations if needed:
closeText
and usecloseIcon
instead.API
Type:
closeIcon: boolean | React.ReactNode
Basic Example
Detailed Design
In all of the components mentioned above, the closeIcon will not render when pass
false
ornull
into closeIcon prop. Otherwise, the closeIcon will be render by pass custom config:About v4.x
Since v4.x no longer accepts new features, if you want to hide the notification close button in v4.x, you can do so by following the link below: https://codesandbox.io/s/ji-ben-antd-5-5-2-forked-itr47d?file=/index.css.
Beta Was this translation helpful? Give feedback.
All reactions