Skip to content

Commit

Permalink
docs(ui-simple-select,ui-select): mention in Select, SimpleSelect doc…
Browse files Browse the repository at this point in the history
…s that option ids must be globally unique
  • Loading branch information
matyasf committed Jan 29, 2025
1 parent 6c85b31 commit 8341b37
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 3 deletions.
3 changes: 2 additions & 1 deletion packages/ui-select/src/Select/Option/props.ts
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,8 @@ import type {

type OptionProps = {
/**
* The id for the option.
* The id for the option. **Must be globally unique**, it will be translated
* to an `id` prop in the DOM.
*/
id: string
/**
Expand Down
5 changes: 4 additions & 1 deletion packages/ui-select/src/Select/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,10 @@ describes: Select
- It should not be used for navigation or as a list of actions/functions. (see [Menu](#Menu)).
- It can behave like a `<select>` element or implement autocomplete behavior.

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

Expand Down
3 changes: 2 additions & 1 deletion packages/ui-simple-select/src/SimpleSelect/Option/props.ts
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,8 @@ type RenderSimpleSelectOptionLabel = Renderable<OptionProps>

type SimpleSelectOptionOwnProps = {
/**
* The id for the option.
* The id for the option. **Must be globally unique**, it will be translated
* to an `id` prop in the DOM.
*/
id: string
/**
Expand Down
3 changes: 3 additions & 0 deletions packages/ui-simple-select/src/SimpleSelect/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,9 @@ describes: SimpleSelect

`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.

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

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

0 comments on commit 8341b37

Please sign in to comment.