Skip to content

Commit

Permalink
fix: add error prop to FormGroup
Browse files Browse the repository at this point in the history
  • Loading branch information
felixmosh committed Sep 4, 2023
1 parent 79ffb36 commit 1f1c389
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 1 deletion.
3 changes: 3 additions & 0 deletions src/collections/Form/FormGroup.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,9 @@ export interface StrictFormGroupProps {
/** A Form Group can be disabled. */
disabled?: boolean

/** A Form Group can have error. */
error?: boolean

/** Fields can show related choices. */
grouped?: boolean

Expand Down
6 changes: 5 additions & 1 deletion src/collections/Form/FormGroup.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,10 @@ import {
* @see Form
*/
const FormGroup = React.forwardRef((props, ref) => {
const { children, className, disabled, grouped, inline, unstackable, widths } = props
const { children, className, disabled, error, grouped, inline, unstackable, widths } = props

const classes = cx(
useKeyOnly(error, 'error'),
useKeyOnly(disabled, 'disabled'),
useKeyOnly(grouped, 'grouped'),
useKeyOnly(inline, 'inline'),
Expand Down Expand Up @@ -52,6 +53,9 @@ FormGroup.propTypes = {
/** A Form Group can be disabled. */
disabled: PropTypes.bool,

/** A Form Group can have error. */
error: PropTypes.bool,

/** Fields can show related choices. */
grouped: customPropTypes.every([customPropTypes.disallow(['inline']), PropTypes.bool]),

Expand Down
1 change: 1 addition & 0 deletions test/specs/collections/Form/FormGroup-test.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ describe('FormGroup', () => {
common.propKeyOnlyToClassName(FormGroup, 'grouped')
common.propKeyOnlyToClassName(FormGroup, 'disabled')
common.propKeyOnlyToClassName(FormGroup, 'inline')
common.propKeyOnlyToClassName(FormGroup, 'error')
common.propKeyOnlyToClassName(FormGroup, 'unstackable')

common.forwardsRef(FormGroup)
Expand Down

0 comments on commit 1f1c389

Please sign in to comment.