-
-
Notifications
You must be signed in to change notification settings - Fork 47.1k
API Naming rules
二货机器人 edited this page Sep 27, 2021
·
24 revisions
Basically, antd naming requires FULL NAME instead of Abbreviation.
- Initialize prop:
default
+PropName
- Force render:
forceRender
- Force render sub component:
force
+Sub Component Name
+Render
- Force render sub component:
- Sub render:
Sub Component Name
+Render
- Data Source:
dataSource
- Panel visible: popup only
visible
, dropdownopen
, additional popuppopupName
+Visible
liketooltipVisible
-
children
:- Mainly display content. To avoid additional prop name.
- Option list like
Select.Option
orTree.TreeNode
. - Customize wrapped component can consider use
component
prop ifchildren
may have other usage in future.
- Display related naming:
show
+PropName
- Functional:
PropName
+able
- Disable:
disabled
- sub component:
disabled
+Sub Component Name
- sub component:
- mainly icon:
icon
- Merge with function first:
functionName: { icon }
. e.g.expandable: { icon: <Smile /> }
- Multiple icons:
FunctionName
+Icon
- Merge with function first:
- Trigger:
trigger
- Sub function trigger:
Sub Function
+Trigger
- Trigger on the time point:
xxx
+On
+EventName
(e.g.destroyOnClose
)
- Sub function trigger:
- Component use other component config. Naming as component.(e.g.
<Table pagination={{...}} />
)
- Trigger event:
on
+EventName
- Trigger sub component event:
on
+SubComponentName
+EventName
(e.g.onSearchChange
) - Trigger prop event:
on
+PropName
+EventName
(e.g.onDragStart
)
- Trigger sub component event:
- Before trigger event:
before
+EventName
- After trigger event:
after
+EventName
ref: #16048
Property | Description | Type | Default |
---|---|---|---|
htmlType | xxx | string | button |
type | xxx |
horizontal | vertical
|
horizontal |
disabled | xxx | boolean | false |
minLength | xxx | number | 0 |
style | xxx | CSSProperties | - |
character | xxx | (props) => ReactNode | - |
offset | xxx | [number, number] | [0, 0] |
value | xxx | string | number | small |
- When string type, the Default use
``
. - Can also list string optional values in Type.
- When boolean type, the Default value is true or false.
- When number type, the Default value use numbers directly.
- When function type, use an arrow function expression in Type.
- No default value use - .
- Capitalize the first letter in Description apart from
someProp
. - No period at the end of the Description.
- API order is arranged in alphabetical order, and can be put together under special circumstances (such as: xs sm md).
ref: #25066
- Home
- Cookbook
- FAQ
- Template for Bug Report in IE8 9
- Contributing
- Maintaining
- Design