Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: allow label on FieldWrapper to be ReactNode #3856

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions .changeset/swift-bugs-sparkle.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
---
'@toptal/picasso-forms': minor
---

### FieldWrapper

- change the type of label from string to ReactNode which allows you to have complex labels
2 changes: 1 addition & 1 deletion packages/picasso-forms/src/FieldLabel/FieldLabel.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import { useFormConfig } from '../FormConfig'

export type Props = {
name?: string
label?: string
label?: React.ReactNode
required?: boolean
} & TextLabelProps

Expand Down
8 changes: 4 additions & 4 deletions packages/picasso-forms/src/FieldWrapper/FieldWrapper.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,10 @@ import type { ValueType, IFormComponentProps } from '../FieldBase'
import FieldLabel from '../FieldLabel'
import InputField from '../InputField'

export type Props<TWrappedComponentProps, TInputValue> = Omit<
FieldProps<TWrappedComponentProps, TInputValue>,
'label'
> & { label?: string }
export type Props<TWrappedComponentProps, TInputValue> = FieldProps<
TWrappedComponentProps,
TInputValue
>
OleksandrNechai marked this conversation as resolved.
Show resolved Hide resolved

const FieldWrapper = <
TWrappedComponentProps extends IFormComponentProps,
Expand Down