-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathc90e9def.51b283e9.js
1 lines (1 loc) · 4.42 KB
/
c90e9def.51b283e9.js
1
(window.webpackJsonp=window.webpackJsonp||[]).push([[26],{104:function(e,t,n){"use strict";n.d(t,"a",(function(){return u})),n.d(t,"b",(function(){return f}));var r=n(0),o=n.n(r);function a(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function i(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,r)}return n}function c(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?i(Object(n),!0).forEach((function(t){a(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):i(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}function l(e,t){if(null==e)return{};var n,r,o=function(e,t){if(null==e)return{};var n,r,o={},a=Object.keys(e);for(r=0;r<a.length;r++)n=a[r],t.indexOf(n)>=0||(o[n]=e[n]);return o}(e,t);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);for(r=0;r<a.length;r++)n=a[r],t.indexOf(n)>=0||Object.prototype.propertyIsEnumerable.call(e,n)&&(o[n]=e[n])}return o}var p=o.a.createContext({}),s=function(e){var t=o.a.useContext(p),n=t;return e&&(n="function"==typeof e?e(t):c(c({},t),e)),n},u=function(e){var t=s(e.components);return o.a.createElement(p.Provider,{value:t},e.children)},d={inlineCode:"code",wrapper:function(e){var t=e.children;return o.a.createElement(o.a.Fragment,{},t)}},m=o.a.forwardRef((function(e,t){var n=e.components,r=e.mdxType,a=e.originalType,i=e.parentName,p=l(e,["components","mdxType","originalType","parentName"]),u=s(n),m=r,f=u["".concat(i,".").concat(m)]||u[m]||d[m]||a;return n?o.a.createElement(f,c(c({ref:t},p),{},{components:n})):o.a.createElement(f,c({ref:t},p))}));function f(e,t){var n=arguments,r=t&&t.mdxType;if("string"==typeof e||r){var a=n.length,i=new Array(a);i[0]=m;var c={};for(var l in t)hasOwnProperty.call(t,l)&&(c[l]=t[l]);c.originalType=e,c.mdxType="string"==typeof e?e:r,i[1]=c;for(var p=2;p<a;p++)i[p]=n[p];return o.a.createElement.apply(null,i)}return o.a.createElement.apply(null,n)}m.displayName="MDXCreateElement"},94:function(e,t,n){"use strict";n.r(t),n.d(t,"frontMatter",(function(){return a})),n.d(t,"metadata",(function(){return i})),n.d(t,"toc",(function(){return c})),n.d(t,"default",(function(){return p}));var r=n(3),o=(n(0),n(104));const a={id:"field",title:"Field",sidebar_label:"Field",slug:"/api/field"},i={unversionedId:"field",id:"field",isDocsHomePage:!1,title:"Field",description:"You can use ` to reduce the code you write for wiring up inputs and handlers to your input element. will only work if it is a descendant of `.",source:"@site/docs/Field.mdx",slug:"/api/field",permalink:"/docs/api/field",editUrl:"https://github.com/formstjs/formst-docs/docs/Field.mdx",version:"current",sidebar_label:"Field",sidebar:"someSidebar",previous:{title:"Formst",permalink:"/docs/api/formst"},next:{title:"ErrorMessage",permalink:"/docs/api/error-message"}},c=[{value:"API",id:"api",children:[]},{value:"Parameters",id:"parameters",children:[]},{value:"Usage",id:"usage",children:[]}],l={toc:c};function p({components:e,...t}){return Object(o.b)("wrapper",Object(r.a)({},l,t,{components:e,mdxType:"MDXLayout"}),Object(o.b)("p",null,"You can use ",Object(o.b)("inlineCode",{parentName:"p"},"<Field />")," to reduce the code you write for wiring up inputs and handlers to your input element. ",Object(o.b)("inlineCode",{parentName:"p"},"<Field />")," will only work if it is a descendant of ",Object(o.b)("inlineCode",{parentName:"p"},"<Formst />"),"."),Object(o.b)("h3",{id:"api"},"API"),Object(o.b)("pre",null,Object(o.b)("code",Object(r.a)({parentName:"pre"},{className:"language-tsx"}),"import {Field} from 'formst';\n\n<Formst formInstance={formInstance}>\n // This will handle name, value, onChange and onBlur props for you\n <Field name=\"field-name\" />\n</Formst>;\n")),Object(o.b)("h3",{id:"parameters"},"Parameters"),Object(o.b)("pre",null,Object(o.b)("code",Object(r.a)({parentName:"pre"},{className:"language-jsx"}),"name: string, required;\ncomponent: string | React.Component;\n")),Object(o.b)("p",null,"Any extra props will be passed down to the child component."),Object(o.b)("h3",{id:"usage"},"Usage"),Object(o.b)("pre",null,Object(o.b)("code",Object(r.a)({parentName:"pre"},{}),'<Field name="title" component={CustomComponent}>\n')))}p.isMDXComponent=!0}}]);