Skip to content

Commit 99189c6

Browse files
imp-danceguidarikodiakhq[bot]
authored
chore: added types for formgroup component (#13988)
Co-authored-by: Guilherme Datilio Ribeiro <guilhermedatilio@gmail.com> Co-authored-by: kodiakhq[bot] <49736102+kodiakhq[bot]@users.noreply.github.com>
1 parent e7800e7 commit 99189c6

1 file changed

Lines changed: 35 additions & 1 deletion

File tree

packages/react/src/components/FormGroup/FormGroup.js renamed to packages/react/src/components/FormGroup/FormGroup.tsx

Lines changed: 35 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,40 @@ import PropTypes from 'prop-types';
99
import React from 'react';
1010
import cx from 'classnames';
1111
import { usePrefix } from '../../internal/usePrefix';
12+
import { ReactAttr } from '../../types/common';
13+
14+
export interface FormGroupProps extends ReactAttr<HTMLFieldSetElement> {
15+
/**
16+
* Provide the children form elements to be rendered inside of the <fieldset>
17+
*/
18+
children: React.ReactNode;
19+
/**
20+
* Provide a custom className to be applied to the containing <fieldset> node
21+
*/
22+
className?: string;
23+
/**
24+
* Specify whether the <FormGroup> is invalid
25+
*/
26+
invalid?: boolean;
27+
/**
28+
* Provide id for the fieldset <legend> which corresponds to the fieldset
29+
* `aria-labelledby`
30+
*/
31+
legendId?: string;
32+
/**
33+
* Provide the text to be rendered inside of the fieldset <legend>
34+
*/
35+
legendText: React.ReactNode;
36+
37+
/**
38+
* Specify whether the message should be displayed in the <FormGroup>
39+
*/
40+
message?: boolean;
41+
/**
42+
* Provide the text for the message in the <FormGroup>
43+
*/
44+
messageText?: string;
45+
}
1246

1347
const FormGroup = ({
1448
legendId,
@@ -19,7 +53,7 @@ const FormGroup = ({
1953
message,
2054
messageText,
2155
...rest
22-
}) => {
56+
}: FormGroupProps) => {
2357
const prefix = usePrefix();
2458

2559
const classNamesFieldset = cx(`${prefix}--fieldset`, className);

0 commit comments

Comments
 (0)