Skip to content

Commit

Permalink
Allow form fields' label to accept any node (#526)
Browse files Browse the repository at this point in the history
  • Loading branch information
bedrich-schindler authored and adamkudrna committed Jul 31, 2024
1 parent a4a8d14 commit 698101c
Show file tree
Hide file tree
Showing 15 changed files with 30 additions and 9 deletions.
2 changes: 1 addition & 1 deletion src/components/CheckboxField/CheckboxField.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -114,7 +114,7 @@ CheckboxField.propTypes = {
/**
* Checkbox field label.
*/
label: PropTypes.string.isRequired,
label: PropTypes.node.isRequired,
/**
* Placement of the label relative to the input.
*/
Expand Down
3 changes: 3 additions & 0 deletions src/components/CheckboxField/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,9 @@ See [API](#api) for all available options.
send me any emails” which would mean that the user needs to turn the
checkbox **on** in order for something **not** to happen.

- **Use text labels** unless it is necessary to wrap text label into
Popover-like to component to provide additional info about the field.

- Only make the CheckboxField's label invisible when there is **another visual
clue** to guide users through toggling the input.

Expand Down
4 changes: 2 additions & 2 deletions src/components/FileInputField/FileInputField.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -123,9 +123,9 @@ FileInputField.propTypes = {
*/
isLabelVisible: PropTypes.bool,
/**
* Text field label.
* File input field label.
*/
label: PropTypes.string.isRequired,
label: PropTypes.node.isRequired,
/**
* Layout of the field.
*
Expand Down
3 changes: 3 additions & 0 deletions src/components/FileInputField/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,9 @@ See [API](#api) for all available options.
polite phrases like _Please attach your file here_. Short labels will help
your users accomplish their task faster.

- **Use text labels** unless it is necessary to wrap text label into
Popover-like to component to provide additional info about the field.

- Only make the FileInputField's label invisible when there is **another visual
clue** to guide users through filling the input.

Expand Down
2 changes: 1 addition & 1 deletion src/components/InputGroup/InputGroup.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -151,7 +151,7 @@ InputGroup.propTypes = {
/**
* Input group label.
*/
label: PropTypes.string.isRequired,
label: PropTypes.node.isRequired,
/**
* Layout of the group.
*
Expand Down
3 changes: 3 additions & 0 deletions src/components/Radio/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,9 @@ See [API](#api) for all available options.
polite phrases like _Please select your favourite fruit_. Short labels will
help your users accomplish their task faster.

- **Use text labels** unless it is necessary to wrap text label into
Popover-like to component to provide additional info about the field.

- Only make the Radio's label invisible when there is **another visual
clue** to guide users through filling the input.

Expand Down
2 changes: 1 addition & 1 deletion src/components/Radio/Radio.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -157,7 +157,7 @@ Radio.propTypes = {
/**
* Label of the group of options.
*/
label: PropTypes.string.isRequired,
label: PropTypes.node.isRequired,
/**
* Layout of the field.
*
Expand Down
3 changes: 3 additions & 0 deletions src/components/SelectField/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,9 @@ See [API](#api) for all available options.
polite phrases like _Please select your favourite fruit_. Short labels will
help your users accomplish their task faster.

- **Use text labels** unless it is necessary to wrap text label into
Popover-like to component to provide additional info about the field.

- Only make the SelectField's label invisible when there is **another visual
clue** to guide users through filling the input. Using the first option as
label is not recommended either — it disappears once user makes their choice.
Expand Down
2 changes: 1 addition & 1 deletion src/components/SelectField/SelectField.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -182,7 +182,7 @@ SelectField.propTypes = {
/**
* Select field label.
*/
label: PropTypes.string.isRequired,
label: PropTypes.node.isRequired,
/**
* Layout of the field.
*
Expand Down
3 changes: 3 additions & 0 deletions src/components/TextArea/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,9 @@ See [API](#api) for all available options.
polite phrases like _Please enter your message_. Short labels will help your
users accomplish their task faster.

- **Use text labels** unless it is necessary to wrap text label into
Popover-like to component to provide additional info about the field.

- Only make the TextArea's label invisible when there is **another visual
clue** to guide users through filling the input. Using the first option as
label is not recommended either — it disappears once user makes their choice.
Expand Down
2 changes: 1 addition & 1 deletion src/components/TextArea/TextArea.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -132,7 +132,7 @@ TextArea.propTypes = {
/**
* Text field label.
*/
label: PropTypes.string.isRequired,
label: PropTypes.node.isRequired,
/**
* Layout of the field.
*
Expand Down
3 changes: 3 additions & 0 deletions src/components/TextField/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,9 @@ See [API](#api) for all available options.
polite phrases like _Please enter your first name_. Short labels will help
your users accomplish their task faster.

- **Use text labels** unless it is necessary to wrap text label into
Popover-like to component to provide additional info about the field.

- Only make the TextField's label invisible when there is **another visual
clue** to guide users through filling the input.

Expand Down
2 changes: 1 addition & 1 deletion src/components/TextField/TextField.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -156,7 +156,7 @@ TextField.propTypes = {
/**
* Text field label.
*/
label: PropTypes.string.isRequired,
label: PropTypes.node.isRequired,
/**
* Layout of the field.
*
Expand Down
3 changes: 3 additions & 0 deletions src/components/Toggle/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,9 @@ See [API](#api) for all available options.
me any emails” which would mean that the user needs to turn the toggle **on**
in order for something **not** to happen.

- **Use text labels** unless it is necessary to wrap text label into
Popover-like to component to provide additional info about the field.

- Only make the Toggle's label invisible when there is **another visual clue**
to guide users through using the input.

Expand Down
2 changes: 1 addition & 1 deletion src/components/Toggle/Toggle.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -114,7 +114,7 @@ Toggle.propTypes = {
/**
* Toggle label.
*/
label: PropTypes.string.isRequired,
label: PropTypes.node.isRequired,
/**
* Placement of the label relative to the input.
*/
Expand Down

0 comments on commit 698101c

Please sign in to comment.