Skip to content

Commit

Permalink
Update textarea.tsx
Browse files Browse the repository at this point in the history
Add showLabel feature to textarea input
  • Loading branch information
th3f0r3ign3r authored Oct 20, 2023
1 parent 5eec76d commit 4c9886f
Showing 1 changed file with 9 additions and 5 deletions.
14 changes: 9 additions & 5 deletions src/components/ui/auto-form/fields/textarea.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -14,14 +14,18 @@ export default function AutoFormTextarea({
fieldConfigItem,
fieldProps,
}: AutoFormInputComponentProps) {
const { showLabel: _showLabel, ...fieldPropsWithoutShowLabel } = fieldProps;
const showLabel = _showLabel === undefined ? true : _showLabel;
return (
<FormItem>
<FormLabel>
{label}
{isRequired && <span className="text-destructive"> *</span>}
</FormLabel>
{showLabel && (
<FormLabel>
{label}
{isRequired && <span className="text-destructive"> *</span>}
</FormLabel>
)}
<FormControl>
<Textarea {...fieldProps} />
<Textarea {...fieldPropsWithoutShowLabel} />
</FormControl>
{fieldConfigItem.description && (
<FormDescription>{fieldConfigItem.description}</FormDescription>
Expand Down

0 comments on commit 4c9886f

Please sign in to comment.