From 7a2f775c5a7b4caf3369731ebb34b1746375618b Mon Sep 17 00:00:00 2001 From: Erin Donehoo <105813956+edonehoo@users.noreply.github.com> Date: Tue, 21 Nov 2023 13:27:07 -0500 Subject: [PATCH] docs(select): Adds documentation to React examples. (#9536) * fix conflicts * docs(select): Adds documentation for React examples. * Adds content to new select React examples. * Updates typeahead with create example. * Clarify mult typeahead with create content. * Finalizing wording. * Updates content from review. --------- Co-authored-by: nicolethoen --- .../src/components/Select/examples/Select.md | 58 ++++++++++++++++--- 1 file changed, 49 insertions(+), 9 deletions(-) diff --git a/packages/react-core/src/components/Select/examples/Select.md b/packages/react-core/src/components/Select/examples/Select.md index 32efd3c8772..3fe39843a71 100644 --- a/packages/react-core/src/components/Select/examples/Select.md +++ b/packages/react-core/src/components/Select/examples/Select.md @@ -13,72 +13,112 @@ import BellIcon from '@patternfly/react-icons/dist/esm/icons/bell-icon'; ## Examples -`Select` builds off of the Menu component suite to wrap commonly used properties and functions for a select menu. See the [Menu documentation](/components/menus/menu) for a full list of properties that may be passed through `Select` to further customize the select menu, or the [custom menu examples](/components/menus/custom-menus) for additional examples of fully functional menus. +Select builds off of the menu component suite to adapt commonly used properties and functions to create a select menu. See the [menu documentation](/components/menus/menu) for a full list of properties that may be used to further customize a select menu. View the [custom menu examples](/components/menus/custom-menus) to see examples of fully functional select menus. -### Single +### Single select +To let users select a single item from a list, use a single select menu. + +You can add multiple `` components to build out a list of menu items. For each select option, pass a relevant option label to the `value` property. + +To disable the select menu toggle, use the `isDisabled` property. In the following example, select the checkbox to observe this behavior. ```ts file="./SelectBasic.tsx" ``` -### Option variations +### Select option variants + +The following example showcases different option variants and customizations that are commonly used in a select menu. + +To create these variants, you can pass different properties into a `` component. -Showcases different option variants and customizations that are commonly used in a select menu. For a more complete list, see the [Menu documentation](/components/menus/menu). +This example provides examples of: + +- An option with a description, which is created by using the `description` property. +- An option with a link, which is created by passing a URL into the `to` property. For external links, use the `isExternalLink` property so that the option is styled with an outbound link icon. +- An option with an icon, which is created by using the `icon` property. +- An option that is disabled by using the `isDisabled` property. ```ts file="./SelectOptionVariations.tsx" ``` -### Grouped single +### With grouped items +To group related select options together, use 1 or more `` components and title each group using the `label` property. ```ts file="./SelectGrouped.tsx" ``` -### Checkbox +### Checkbox select +To let users select multiple list options via checkbox input, use a checkbox select. + +To create a checkbox select, pass `role="menu"` to the `