Skip to content

Commit 676467e

Browse files
committed
feat(pf4): add group and divider to select options
1 parent 8598057 commit 676467e

File tree

3 files changed

+14
-1
lines changed

3 files changed

+14
-1
lines changed

packages/pf4-component-mapper/src/select/select.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ const Select = (props) => {
1919
id={id || input.name}
2020
FormGroupProps={FormGroupProps}
2121
>
22-
<DataDrivenSelect {...input} {...rest} isDisabled={isDisabled || isReadOnly} />
22+
<DataDrivenSelect {...input} {...rest} isDisabled={isDisabled || isReadOnly} useFlatOptions />
2323
</FormGroup>
2424
);
2525
};

packages/pf4-component-mapper/src/select/select/menu.js

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -131,6 +131,18 @@ const Menu = ({
131131
/>
132132
)}
133133
{filteredOptions.map((item, index) => {
134+
if (item.group) {
135+
return (
136+
<div className="pf-c-select__menu-group" key={`group-${index}`}>
137+
<div className="pf-c-select__menu-group-title">{item.group}</div>
138+
</div>
139+
);
140+
}
141+
142+
if (item.divider) {
143+
return <hr className="pf-c-divider" key={`divider-${index}`} />;
144+
}
145+
134146
const itemProps = getItemProps({
135147
item,
136148
index,

packages/pf4-component-mapper/src/select/select/select.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -238,6 +238,7 @@ InternalSelect.propTypes = {
238238
PropTypes.shape({
239239
value: PropTypes.any,
240240
label: PropTypes.any,
241+
divider: PropTypes.bool,
241242
})
242243
).isRequired,
243244
value: PropTypes.any,

0 commit comments

Comments
 (0)