Skip to content

Commit 8341b37

Browse files
committed
docs(ui-simple-select,ui-select): mention in Select, SimpleSelect docs that option ids must be globally unique
1 parent 6c85b31 commit 8341b37

File tree

4 files changed

+11
-3
lines changed

4 files changed

+11
-3
lines changed

packages/ui-select/src/Select/Option/props.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,8 @@ import type {
3333

3434
type OptionProps = {
3535
/**
36-
* The id for the option.
36+
* The id for the option. **Must be globally unique**, it will be translated
37+
* to an `id` prop in the DOM.
3738
*/
3839
id: string
3940
/**

packages/ui-select/src/Select/README.md

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,10 @@ describes: Select
88
- It should not be used for navigation or as a list of actions/functions. (see [Menu](#Menu)).
99
- It can behave like a `<select>` element or implement autocomplete behavior.
1010

11-
> Note: Before implementing Select, see if a [SimpleSelect](#SimpleSelect) will suffice.
11+
> Notes:
12+
>
13+
> - Before implementing Select, see if a [SimpleSelect](#SimpleSelect) will suffice.
14+
> - The `id` prop on options must be globally unique, it will be translated to an `id` prop in the DOM.
1215
1316
#### Managing state for a Select
1417

packages/ui-simple-select/src/SimpleSelect/Option/props.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,8 @@ type RenderSimpleSelectOptionLabel = Renderable<OptionProps>
4343

4444
type SimpleSelectOptionOwnProps = {
4545
/**
46-
* The id for the option.
46+
* The id for the option. **Must be globally unique**, it will be translated
47+
* to an `id` prop in the DOM.
4748
*/
4849
id: string
4950
/**

packages/ui-simple-select/src/SimpleSelect/README.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,9 @@ describes: SimpleSelect
44

55
`SimpleSelect` is a higher level abstraction of [Select](#Select) that closely parallels the functionality of standard HTML `<select>` elements. It does not support autocomplete behavior and is much less configurable than [Select](#Select). However, because it is more opinionated, `SimpleSelect` can be implemented with very little boilerplate.
66

7+
> Note: The `id` prop on options must be globally unique, it will be translated to an `id` prop
8+
> in the DOM.
9+
710
### Uncontrolled
811

912
For the most basic implementations, `SimpleSelect` can be uncontrolled. If desired, the `defaultValue` prop can be used to set the initial selection.

0 commit comments

Comments
 (0)