Skip to content

Commit df18e6a

Browse files
authored
docs(core): update CHANGELOG.md and documentation
1 parent e092cab commit df18e6a

File tree

2 files changed

+38
-0
lines changed

2 files changed

+38
-0
lines changed

CHANGELOG.md

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,18 @@ should change the heading of the (upcoming) version to include a major version b
1616
1717
-->
1818

19+
# 5.23.0
20+
21+
## @rjsf/core
22+
23+
- Updated `SelectWidget` to support `<optgroup>` through `ui:options` `optgroup`. Fixes [#1813]
24+
25+
## @rjsf/playground
26+
27+
- Updated `samples/widgets` to show `optgroup` usage (`selectWidgetOptions3`)
28+
29+
## Dev / docs / playground
30+
1931
# 5.22.4
2032

2133
## @rjsf/utils

packages/docs/docs/api-reference/uiSchema.md

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -344,6 +344,32 @@ render(<Form schema={schema} uiSchema={uiSchema} validator={validator} />, docum
344344

345345
This property allows you to reorder the properties that are shown for a particular object. See [Objects](../json-schema/objects.md) for more information.
346346

347+
### optgroup
348+
349+
To leverage `<optgroup>` inside a select to group `<options>`, you can specify how to organize the options using the `optgroups` key inside your uiSchema.
350+
351+
```tsx
352+
import { Form } from '@rjsf/core';
353+
import { RJSFSchema, UiSchema } from '@rjsf/utils';
354+
import validator from '@rjsf/validator-ajv8';
355+
356+
const schema: RJSFSchema = {
357+
type: 'string',
358+
enum: ['lorem', 'ipsum', 'dolorem', 'alpha', 'beta', 'gamma']
359+
};
360+
361+
const uiSchema: UiSchema = {
362+
'ui:options': {
363+
optgroups: {
364+
lipsum: ['lorem', 'ipsum', 'dolorem'],
365+
greek: ['alpha', 'beta', 'gamma']
366+
}
367+
},
368+
};
369+
370+
render(<Form schema={schema} uiSchema={uiSchema} validator={validator} />, document.getElementById('app'));
371+
```
372+
347373
### placeholder
348374

349375
You can add placeholder text to an input by using the `ui:placeholder` uiSchema directive:

0 commit comments

Comments
 (0)