Skip to content

Commit

Permalink
fix(TextAreaField): Generate id if not provided (#49)
Browse files Browse the repository at this point in the history
  • Loading branch information
dougmacknz authored Oct 12, 2023
1 parent 2a0c787 commit 0860b51
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 2 deletions.
5 changes: 5 additions & 0 deletions .changeset/big-maps-shave.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"@kaizen/draft-form": patch
---

Generate ID for TextAreaField if id prop not provided
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import React from "react"
import React, { useState } from "react"
import classnames from "classnames"
import { v4 } from "uuid"
import {
FieldGroup,
FieldMessage,
Expand Down Expand Up @@ -28,12 +29,13 @@ export const TextAreaField = ({
validationMessage,
description,
variant = "default",
id,
id: propsId,
reversed = false,
status = "default",
disabled,
...restProps
}: TextAreaFieldProps): JSX.Element => {
const [id] = useState<string>(propsId || v4())
const validationMessageAria = validationMessage
? `${id}-field-validation-message`
: ""
Expand Down

0 comments on commit 0860b51

Please sign in to comment.