Skip to content

Commit

Permalink
fix(input): allow input to work with hook form library
Browse files Browse the repository at this point in the history
  • Loading branch information
richbachman committed Mar 9, 2021
1 parent be3643a commit 14d3396
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 2 deletions.
5 changes: 5 additions & 0 deletions .changeset/wise-mangos-appear.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'@twilio-paste/input': patch
---

Removed required from the `id` prop, so Input can be used as an uncontrolled component. This allows Input to be used with libraries like `React-Hook-Form`.
4 changes: 2 additions & 2 deletions packages/paste-core/components/input/src/Input.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ export interface InputProps extends React.InputHTMLAttributes<HTMLInputElement>
disabled?: boolean;
hasError?: boolean;
height?: never;
id: string;
id?: string;
insertAfter?: React.ReactNode;
insertBefore?: React.ReactNode;
name?: string;
Expand Down Expand Up @@ -137,7 +137,7 @@ if (process.env.NODE_ENV === 'development') {
// eslint-disable-next-line @typescript-eslint/no-explicit-any
disabled: PropTypes.bool,
hasError: PropTypes.bool,
id: PropTypes.string.isRequired,
id: PropTypes.string,
name: PropTypes.string,
onBlur: PropTypes.func,
onChange: PropTypes.func,
Expand Down

0 comments on commit 14d3396

Please sign in to comment.