Created API Naming rules (markdown)

zombieJ 2019-04-24 11:52:28 +08:00
parent f5ed59a4f8
commit f65a1f7602

28
API-Naming-rules.md Normal file

@ -0,0 +1,28 @@
Basically, antd naming requires **FULL NAME** instead of Abbreviation.
## Props
* Initialize prop: `default` + `PropName`
* Force render: `forceRender`
* Force render sub component: `force` + `Sub Component Name` + `Render`
* Data Source: `dataSource`
* `children`:
* Mainly display content. To avoid additional prop name.
* Option list like `Select.Option` or `Tree.TreeNode`.
* Customize wrapped component can consider use `component` prop if `children` may have other usage in future.
* Display related naming: `show` + `PropName`
* Functional: `PropName` + `able`
* Disable: `disabled`
* sub component: `disabled` + `Sub Component Name`
* mainly icon: `icon`
* Multiple icons: `FunctionName` + `Icon`
* Trigger: `trigger`
* Sub function trigger: `Sub Function` + `Trigger`
* Trigger on the time point: `xxx` + `On` + `EventName` (e.g. `destroyOnClose`)
## Event
* Trigger event: `on` + `EventName`
* Before trigger event: `before` + `EventName`
* After trigger event: `after` + `EventName`
## Current listing api
ref: [#16048](https://github.com/ant-design/ant-design/issues/16048)