diff --git a/src/v2/api/index.md b/src/v2/api/index.md index c9231f7c66..bf5b600a1b 100644 --- a/src/v2/api/index.md +++ b/src/v2/api/index.md @@ -509,6 +509,15 @@ type: api A list/hash of attributes that are exposed to accept data from the parent component. It has an Array-based simple syntax and an alternative Object-based syntax that allows advanced configurations such as type checking, custom validation and default values. + With Object-based syntax, you can use following options: + - **type:** can be one of the following native constructors: `String`, `Number`, `Boolean`, `Array`, `Object`, `Date`, `Function`, `Symbol`, any custom constructor function or an array of those. Will check if a prop has a given type, and will throw a warning if it doesn't. [More information](../guide/components-props.html#Prop-Types) on prop types. + - **default:** `any` + Specifies a default value for the prop. If the prop is not passed, this value will be used instead. Object or array defaults must be returned from a factory function. + - **required:** `Boolean` + Defines if the prop is required. In a non-production environment, a console warning will be thrown if this value is truthy and the prop is not passed. + - **validator:** `Function` + Custom validator function that takes the prop value as the sole argument. In a non-production environment, a console warning will be thrown if this function returns a falsy value (i.e. the validation fails). You can read more about prop validation [here](../guide/components-props.html#Prop-Validation). + - **Example:** ``` js @@ -535,7 +544,7 @@ type: api }) ``` -- **See also:** [Props](../guide/components.html#Props) +- **See also:** [Props](../guide/components-props.html) ### propsData