Skip to content

Commit

Permalink
fix: fix missing description
Browse files Browse the repository at this point in the history
  • Loading branch information
huhuanming committed Oct 19, 2023
1 parent 91ab28e commit 4daa384
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 1 deletion.
8 changes: 7 additions & 1 deletion packages/components/src/Form/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -64,9 +64,10 @@ const getChildProps = (
type FieldProps = Omit<GetProps<typeof Controller>, 'render'> &
PropsWithChildren<{
label?: string;
description?: string;
}>;

function Field({ name, label, rules, children }: FieldProps) {
function Field({ name, label, description, rules, children }: FieldProps) {
const {
control,
trigger,
Expand Down Expand Up @@ -96,6 +97,11 @@ function Field({ name, label, rules, children }: FieldProps) {
)
: child,
)}
{description ? (
<Text variant="$bodyMd" color="$textSubdued">
{description}
</Text>
) : null}
<AnimatePresence>
{error?.message && (
<Text
Expand Down
1 change: 1 addition & 0 deletions packages/kit/src/views/Components/stories/Form.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@ const Form1 = () => {
<Form.Field
label="Required"
name="required"
description="This field is required"
rules={{ required: { value: true, message: 'requied input text' } }}
>
<Input placeholder="Required" />
Expand Down

0 comments on commit 4daa384

Please sign in to comment.