Skip to content

Commit 084ba39

Browse files
author
Gustav Hansen
authored
Merge pull request #690 from strapi/enh/required-combobox
Pass the required prop to the combobox FieldLabel
2 parents b00351a + 42add10 commit 084ba39

File tree

1 file changed

+17
-10
lines changed

1 file changed

+17
-10
lines changed

packages/strapi-design-system/src/Combobox/Combobox.js

Lines changed: 17 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -20,25 +20,27 @@ import { KeyboardKeys } from '../helpers/keyboardKeys';
2020
import { VisuallyHidden } from '../VisuallyHidden';
2121

2222
export const Combobox = ({
23+
children: nodes,
2324
clearLabel,
25+
creatable,
2426
createMessage,
2527
disabled,
26-
hint,
2728
error,
29+
hasMoreItems,
30+
hint,
2831
label,
29-
value,
30-
onChange,
31-
placeholder,
32-
creatable,
32+
labelAction,
3333
loading,
3434
loadingMessage,
35+
noOptionsMessage,
36+
onChange,
37+
onClear,
3538
onCreateOption,
3639
onInputChange,
3740
onLoadMore,
38-
noOptionsMessage,
39-
hasMoreItems,
40-
children: nodes,
41-
onClear,
41+
placeholder,
42+
required,
43+
value,
4244
...props
4345
}) => {
4446
const getInputValueFromNodes = () =>
@@ -250,7 +252,11 @@ export const Combobox = ({
250252
{value}
251253
</VisuallyHidden>
252254
<Stack spacing={label || hint || error ? 1 : 0}>
253-
{label && <FieldLabel id={labelId}>{label}</FieldLabel>}
255+
{label && (
256+
<FieldLabel action={labelAction} required={required} id={labelId}>
257+
{label}
258+
</FieldLabel>
259+
)}
254260
<MainRow ref={containerRef} $disabled={disabled} hasError={error}>
255261
<InputContainer wrap="wrap">
256262
{!inputValue && value && (
@@ -396,6 +402,7 @@ Combobox.propTypes = {
396402
hasMoreItems: PropTypes.bool,
397403
hint: PropTypes.oneOfType([PropTypes.string, PropTypes.node, PropTypes.arrayOf(PropTypes.node)]),
398404
label: PropTypes.string,
405+
labelAction: PropTypes.element,
399406
loading: PropTypes.bool,
400407
loadingMessage: PropTypes.string,
401408
noOptionsMessage: PropTypes.func,

0 commit comments

Comments
 (0)