{ "name": "field", "file": "compositions/ui/field", "snippet": "import { Field as ChakraField } from \"@chakra-ui/react\"\nimport * as React from \"react\"\n\nexport interface FieldProps extends Omit {\n label?: React.ReactNode\n helperText?: React.ReactNode\n errorText?: React.ReactNode\n optionalText?: React.ReactNode\n}\n\nexport const Field = React.forwardRef(\n function Field(props, ref) {\n const { label, children, helperText, errorText, optionalText, ...rest } =\n props\n return (\n \n {label && (\n \n {label}\n \n \n )}\n {children}\n {helperText && (\n {helperText}\n )}\n {errorText && (\n {errorText}\n )}\n \n )\n },\n)\n", "examples": [ { "name": "field-basic", "content": "export const FieldBasic = () => {\n return (\n \n Email\n \n \n )\n}\n", "hasSnippet": false, "importPaths": [ "import { Field, Input } from \"@chakra-ui/react\"" ], "importPath": "import { Field } from \"@chakra-ui/react\"" }, { "name": "field-closed-component", "content": "export interface FieldProps extends Omit {\n label?: React.ReactNode\n helperText?: React.ReactNode\n errorText?: React.ReactNode\n optionalText?: React.ReactNode\n}\n\nexport const Field = React.forwardRef(\n function Field(props, ref) {\n const { label, children, helperText, errorText, optionalText, ...rest } =\n props\n return (\n \n {label && (\n \n {label}\n \n \n )}\n {children}\n {helperText && (\n {helperText}\n )}\n {errorText && (\n {errorText}\n )}\n \n )\n },\n)\n", "hasSnippet": false, "importPaths": [ "import { Field as ChakraField } from \"@chakra-ui/react\"", "import * as React from \"react\"" ], "importPath": "import { Field } from \"@chakra-ui/react\"" }, { "name": "field-horizontal", "content": "export const FieldHorizontal = () => {\n return (\n \n \n Name\n \n \n\n \n Email\n \n \n\n \n Hide email\n \n \n \n \n \n \n )\n}\n", "hasSnippet": false, "importPaths": [ "import { Field, Input, Stack, Switch } from \"@chakra-ui/react\"" ], "importPath": "import { Field } from \"@chakra-ui/react\"" }, { "name": "field-with-disabled", "content": "export const FieldWithDisabled = () => {\n return (\n \n Email\n \n \n )\n}\n", "hasSnippet": false, "importPaths": [ "import { Field, Input } from \"@chakra-ui/react\"" ], "importPath": "import { Field } from \"@chakra-ui/react\"" }, { "name": "field-with-error-text", "content": "export const FieldWithErrorText = () => {\n return (\n \n Email\n \n This is an error text\n \n )\n}\n", "hasSnippet": false, "importPaths": [ "import { Field, Input } from \"@chakra-ui/react\"" ], "importPath": "import { Field } from \"@chakra-ui/react\"" }, { "name": "field-with-helper-text", "content": "export const FieldWithHelperText = () => {\n return (\n \n Email\n \n This is a helper text\n \n )\n}\n", "hasSnippet": false, "importPaths": [ "import { Field, Input } from \"@chakra-ui/react\"" ], "importPath": "import { Field } from \"@chakra-ui/react\"" }, { "name": "field-with-native-select", "content": "export const FieldWithNativeSelect = () => {\n return (\n \n Email\n \n \n \n \n \n \n \n \n \n )\n}\n", "hasSnippet": false, "importPaths": [ "import { Field, NativeSelect } from \"@chakra-ui/react\"" ], "importPath": "import { Field } from \"@chakra-ui/react\"" }, { "name": "field-with-optional", "content": "export const FieldWithOptional = () => {\n return (\n \n \n Email\n \n Optional\n \n }\n />\n \n \n \n )\n}\n", "hasSnippet": false, "importPaths": [ "import { Badge, Field, Input } from \"@chakra-ui/react\"" ], "importPath": "import { Field } from \"@chakra-ui/react\"" }, { "name": "field-with-required", "content": "export const FieldWithRequired = () => {\n return (\n \n \n Email\n \n \n \n \n )\n}\n", "hasSnippet": false, "importPaths": [ "import { Field, Input } from \"@chakra-ui/react\"" ], "importPath": "import { Field } from \"@chakra-ui/react\"" }, { "name": "field-with-textarea", "content": "export const FieldWithTextarea = () => {\n return (\n \n Email\n