From e84d7491c42d102c8288b548a59aca277daa1d99 Mon Sep 17 00:00:00 2001 From: Pavel Prichodko <14926950+prichodko@users.noreply.github.com> Date: Wed, 6 Apr 2022 14:04:42 +0200 Subject: [PATCH] feat(system): add label to Input component --- .../src/system/text-input/text-input.tsx | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/packages/status-react/src/system/text-input/text-input.tsx b/packages/status-react/src/system/text-input/text-input.tsx index 5cd3b25..9619970 100644 --- a/packages/status-react/src/system/text-input/text-input.tsx +++ b/packages/status-react/src/system/text-input/text-input.tsx @@ -1,6 +1,7 @@ import React, { forwardRef } from 'react' import { Box } from '../box' +import { Text } from '../text' import { Base } from './styles' import type { Ref } from 'react' @@ -10,11 +11,13 @@ type InputProps = React.InputHTMLAttributes interface Props { id?: string name?: string + label?: string type?: InputProps['type'] value?: string defaultValue?: string onChange?: InputProps['onChange'] onBlur?: InputProps['onBlur'] + onClick?: InputProps['onClick'] disabled?: boolean readOnly?: boolean required?: boolean @@ -28,9 +31,16 @@ interface Props { } const TextInput = (props: Props, ref: Ref) => { + const { label, ...inputProps } = props + return ( - + {label && ( + + {label} + + )} + ) }