New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[Select] Improve spacing and types #9095
Conversation
size-limit report 📦
|
.changeset/happy-adults-accept.md
Outdated
'@shopify/polaris': patch | ||
--- | ||
|
||
Improve spacing and types on select component |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Improve spacing and types on select component | |
Improved spacing and types on `Select` component |
@@ -16,7 +16,7 @@ interface StrictOption { | |||
/** Machine value of the option; this is the value passed to `onChange` */ | |||
value: string; | |||
/** Human-readable text for the option */ | |||
label: string; | |||
label: string | React.ReactNode; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
label: string | React.ReactNode; | |
label: React.ReactNode; |
ReactNode includes string
as type so we don't need to explicitly include string.
@FCalabria do you mind providing a spin instance that shows these changes? You can use the I'm also going to add @sarahill for review from a design perspective. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
✅
/snapit |
🫰✨ Thanks @FCalabria! Your snapshots have been published to npm. Test the snapshots by updating your yarn add @shopify/polaris-cli@0.0.0-snapshot-release-20230502084619 yarn add @shopify/polaris@0.0.0-snapshot-release-20230502084619 |
51b2cff
to
8b880c5
Compare
@laurkim Sure! Here you go. I have changed the "best selling" option on the collection detail sort order so you can see both changes in action. |
Reverts the type change to Select option labels inv #9095
This PR was opened by the [Changesets release](https://github.com/changesets/action) GitHub action. When you're ready to do a release, you can merge this and the packages will be published to npm automatically. If you're not ready to do a release yet, that's fine, whenever you add more changesets to main, this PR will be updated. # Releases ## @shopify/polaris-icons@6.16.0 ### Minor Changes - [#9153](#9153) [`4e343a180`](4e343a1) Thanks [@dGoligorsky](https://github.com/dGoligorsky)! - Updated thumbs up and down icons, major and minor sets - [#9109](#9109) [`5be210bd5`](5be210b) Thanks [@heyjoethomas](https://github.com/heyjoethomas)! - Updated design for MarketingMajor icon ## @shopify/polaris@10.50.0 ### Minor Changes - [#9005](#9005) [`487df3a4d`](487df3a) Thanks [@zakwarsame](https://github.com/zakwarsame)! - - Deprecated ellipsis and introduced a truncate prop to `ActionList` items. - Added a custom width to the new `TopBar` user menu. - [#9145](#9145) [`6ead43c3c`](6ead43c) Thanks [@laurkim](https://github.com/laurkim)! - Deprecated `LegacyFilters` - [#9197](#9197) [`92214e8fd`](92214e8) Thanks [@pt8o](https://github.com/pt8o)! - Added support for sectioning the `filters` of `IndexFilters` and `AlphaFilters` - [#9222](#9222) [`a9d611401`](a9d6114) Thanks [@nat-king](https://github.com/nat-king)! - Added the `suffix` property to the FilterInterface - [#9147](#9147) [`082fe4308`](082fe43) Thanks [@laurkim](https://github.com/laurkim)! - Added component pages and examples for `AlphaTabs` and `AlphaFilters` on style guide - [#9224](#9224) [`b228b67f2`](b228b67) Thanks [@nat-king](https://github.com/nat-king)! - Added optional `onAddFilterClick` callback prop to the AlphaFilters component ### Patch Changes - [#9166](#9166) [`048502ceb`](048502c) Thanks [@martenbjork](https://github.com/martenbjork)! - Fixed the border radius of `DropZone` - [#9155](#9155) [`563af5094`](563af50) Thanks [@ryanwilsonperkin](https://github.com/ryanwilsonperkin)! - Fix PortalsManager to avoid setting state synchronously during a render pass which prevented it from working properly with Suspense. - [#9248](#9248) [`5548436ca`](5548436) Thanks [@chloerice](https://github.com/chloerice)! - Reverted support for `ReactNode` labels on `Select` `options` - [#9148](#9148) [`11f4cef4a`](11f4cef) Thanks [@samrose3](https://github.com/samrose3)! - Recalculated IndexTable sticky header column widths inside of a `useIsomorphicLayoutEffect` after the table is updated. - [#9231](#9231) [`f7f160d0f`](f7f160d) Thanks [@skparkk](https://github.com/skparkk)! - Fixed `Tooltip` rendering when `active` prop is false - [#9095](#9095) [`9fdc798a5`](9fdc798) Thanks [@FCalabria](https://github.com/FCalabria)! - Improved spacing and types on `Select` component - [#9106](#9106) [`2f2edd8fc`](2f2edd8) Thanks [@samrose3](https://github.com/samrose3)! - Fixed padding on AlphaFilter in IndexFilter when hideQueryField is true - [#8957](#8957) [`bb67c17da`](bb67c17) Thanks [@bsharrow](https://github.com/bsharrow)! - Fixed `FilterPill` so that it no longer opens an applied filter's popover by default - [#9154](#9154) [`66d0adc9a`](66d0adc) Thanks [@gui-santos](https://github.com/gui-santos)! - Change default value of Tooltip position to `above` - [#9206](#9206) [`76ed72b41`](76ed72b) Thanks [@alllx](https://github.com/alllx)! - Fix IndexTable sticky column header overlap - [#9169](#9169) [`84189fef1`](84189fe) Thanks [@rcaplanshopify](https://github.com/rcaplanshopify)! - [Popover] Updates fullHeight styles to prevent scroll position reset when Popover content changes - [#9195](#9195) [`e9bbbb437`](e9bbbb4) Thanks [@kyledurand](https://github.com/kyledurand)! - Fixed critical color on progress bar - [#9160](#9160) [`fed35736b`](fed3573) Thanks [@jbalsas](https://github.com/jbalsas)! - Adjusted colours of disabled `Listbox.TextOption` and `OptionList` components for better readability and a11y - Updated dependencies \[[`5a9b011d1`](5a9b011), [`4e343a180`](4e343a1), [`5be210bd5`](5be210b)]: - @shopify/polaris-tokens@6.14.0 - @shopify/polaris-icons@6.16.0 ## @shopify/polaris-tokens@6.14.0 ### Minor Changes - [#9144](#9144) [`5a9b011d1`](5a9b011) Thanks [@dGoligorsky](https://github.com/dGoligorsky)! - Updated color-icon-magic to the correct shade of purple[500] ## @shopify/polaris-cli@0.1.37 ### Patch Changes - Updated dependencies \[]: - @shopify/polaris-migrator@0.18.2 ## @shopify/polaris-codemods@0.1.2 ### Patch Changes - Updated dependencies \[[`5a9b011d1`](5a9b011), [`6ae3295e7`](6ae3295)]: - @shopify/polaris-tokens@6.14.0 - @shopify/stylelint-polaris@12.0.1 ## @shopify/polaris-migrator@0.18.2 ### Patch Changes - Updated dependencies \[[`5a9b011d1`](5a9b011), [`6ae3295e7`](6ae3295)]: - @shopify/polaris-tokens@6.14.0 - @shopify/stylelint-polaris@12.0.1 ## @shopify/stylelint-polaris@12.0.1 ### Patch Changes - [#9228](#9228) [`6ae3295e7`](6ae3295) Thanks [@BPScott](https://github.com/BPScott)! - Widen stylelint peerDependency range to include v15 - Updated dependencies \[[`5a9b011d1`](5a9b011)]: - @shopify/polaris-tokens@6.14.0 ## polaris.shopify.com@0.53.0 ### Minor Changes - [#9145](#9145) [`6ead43c3c`](6ead43c) Thanks [@laurkim](https://github.com/laurkim)! - Deprecated `LegacyFilters` - [#9172](#9172) [`0534cd2ea`](0534cd2) Thanks [@heyjoethomas](https://github.com/heyjoethomas)! - Updated contribution section on doc site to be more concise and clear. - [#9202](#9202) [`ffe96a05f`](ffe96a0) Thanks [@yurm04](https://github.com/yurm04)! - Added `service` endpoint for analytics calls - [#9147](#9147) [`082fe4308`](082fe43) Thanks [@laurkim](https://github.com/laurkim)! - Added component pages and examples for `AlphaTabs` and `AlphaFilters` on style guide - [#9246](#9246) [`a8c1443cc`](a8c1443) Thanks [@yurm04](https://github.com/yurm04)! - Added auth header for service api ### Patch Changes - [#9191](#9191) [`c1dd9ec1f`](c1dd9ec) Thanks [@gwyneplaine](https://github.com/gwyneplaine)! - Fix component names in layout-and-structure index page to prevent 404s. - [#9150](#9150) [`aac73a9ab`](aac73a9) Thanks [@aveline](https://github.com/aveline)! - Update `Icons` content on styleguide - [#9186](#9186) [`d32c7270e`](d32c727) Thanks [@heyjoethomas](https://github.com/heyjoethomas)! - Republish new feature pattern guidance. - [#9111](#9111) [`fb102fbc1`](fb102fb) Thanks [@laurkim](https://github.com/laurkim)! - Updated `SettingTogle` to show `with primitive components` first in style guide - [#9179](#9179) [`41954ff7d`](41954ff) Thanks [@gwyneplaine](https://github.com/gwyneplaine)! - Update banner styles and copy on Patterns page - Updated dependencies \[[`048502ceb`](048502c), [`5a9b011d1`](5a9b011), [`563af5094`](563af50), [`5548436ca`](5548436), [`4e343a180`](4e343a1), [`487df3a4d`](487df3a), [`11f4cef4a`](11f4cef), [`f7f160d0f`](f7f160d), [`9fdc798a5`](9fdc798), [`2f2edd8fc`](2f2edd8), [`bb67c17da`](bb67c17), [`66d0adc9a`](66d0adc), [`6ead43c3c`](6ead43c), [`92214e8fd`](92214e8), [`5be210bd5`](5be210b), [`a9d611401`](a9d6114), [`76ed72b41`](76ed72b), [`84189fef1`](84189fe), [`e9bbbb437`](e9bbbb4), [`fed35736b`](fed3573), [`082fe4308`](082fe43), [`b228b67f2`](b228b67)]: - @shopify/polaris@10.50.0 - @shopify/polaris-tokens@6.14.0 - @shopify/polaris-icons@6.16.0 Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
### WHY are these changes introduced? There are two different changes here: 1. Set equal spacing to both size of the `prefix` when the select has an inline label. Previously the spacing on the left side was smaller than the spacing on the right, which made the prefix look more related to the select label than to that specific option. Now both sides have equal spacing. Before: ![](https://screenshot.click/26-54-xs84i-um2i0.png) After: ![](https://screenshot.click/26-55-sgbwy-x2v7u.png) 2. Change type for `StrictOption.label` to allow the use of `React.ReactNode` too. This way we can use styled text on it ![](https://screenshot.click/26-56-ly7te-l30l0.png) ### How to 🎩 🖥 [Local development instructions](https://github.com/Shopify/polaris/blob/main/README.md#local-development) 🗒 [General tophatting guidelines](https://github.com/Shopify/polaris/blob/main/documentation/Tophatting.md) 📄 [Changelog guidelines](https://github.com/Shopify/polaris/blob/main/.github/CONTRIBUTING.md#changelog) Spin: https://admin.web.select-changes.paqui-calabria.eu.spin.dev/store/shop1/collections/1 <details> <summary>Copy-paste this code in <code>playground/Playground.tsx</code>:</summary> ```jsx import React, {useCallback, useState} from 'react'; import {EnableSelectionMinor} from '@shopify/polaris-icons'; import {Icon, Page, Select, Text} from '../src'; export function Playground() { const [selected, setSelected] = useState('newestUpdate'); const handleSelectChange = useCallback( (value: string) => setSelected(value), [], ); const options = [ { label: 'Better spacing', value: 'adjustSpacing', prefix: <Icon source={EnableSelectionMinor} />, }, { label: ( <Text as="span" color="success" fontWeight="bold"> Label as react node </Text> ), value: 'reactNodeLabel', }, ]; return ( <Page title="Playground"> <Select label="Sort by" labelInline options={options} onChange={handleSelectChange} value={selected} /> </Page> ); } ``` </details> ### 🎩 checklist - [ ] Tested on [mobile](https://github.com/Shopify/polaris/blob/main/documentation/Tophatting.md#cross-browser-testing) - [ ] Tested on [multiple browsers](https://help.shopify.com/en/manual/shopify-admin/supported-browsers) - [ ] Tested for [accessibility](https://github.com/Shopify/polaris/blob/main/documentation/Accessibility%20testing.md) - [ ] Updated the component's `README.md` with documentation changes - [ ] [Tophatted documentation](https://github.com/Shopify/polaris/blob/main/documentation/Tophatting%20documentation.md) changes in the style guide
Reverts the type change to Select option labels inv Shopify#9095
This PR was opened by the [Changesets release](https://github.com/changesets/action) GitHub action. When you're ready to do a release, you can merge this and the packages will be published to npm automatically. If you're not ready to do a release yet, that's fine, whenever you add more changesets to main, this PR will be updated. # Releases ## @shopify/polaris-icons@6.16.0 ### Minor Changes - [Shopify#9153](Shopify#9153) [`4e343a180`](Shopify@4e343a1) Thanks [@dGoligorsky](https://github.com/dGoligorsky)! - Updated thumbs up and down icons, major and minor sets - [Shopify#9109](Shopify#9109) [`5be210bd5`](Shopify@5be210b) Thanks [@heyjoethomas](https://github.com/heyjoethomas)! - Updated design for MarketingMajor icon ## @shopify/polaris@10.50.0 ### Minor Changes - [Shopify#9005](Shopify#9005) [`487df3a4d`](Shopify@487df3a) Thanks [@zakwarsame](https://github.com/zakwarsame)! - - Deprecated ellipsis and introduced a truncate prop to `ActionList` items. - Added a custom width to the new `TopBar` user menu. - [Shopify#9145](Shopify#9145) [`6ead43c3c`](Shopify@6ead43c) Thanks [@laurkim](https://github.com/laurkim)! - Deprecated `LegacyFilters` - [Shopify#9197](Shopify#9197) [`92214e8fd`](Shopify@92214e8) Thanks [@pt8o](https://github.com/pt8o)! - Added support for sectioning the `filters` of `IndexFilters` and `AlphaFilters` - [Shopify#9222](Shopify#9222) [`a9d611401`](Shopify@a9d6114) Thanks [@nat-king](https://github.com/nat-king)! - Added the `suffix` property to the FilterInterface - [Shopify#9147](Shopify#9147) [`082fe4308`](Shopify@082fe43) Thanks [@laurkim](https://github.com/laurkim)! - Added component pages and examples for `AlphaTabs` and `AlphaFilters` on style guide - [Shopify#9224](Shopify#9224) [`b228b67f2`](Shopify@b228b67) Thanks [@nat-king](https://github.com/nat-king)! - Added optional `onAddFilterClick` callback prop to the AlphaFilters component ### Patch Changes - [Shopify#9166](Shopify#9166) [`048502ceb`](Shopify@048502c) Thanks [@martenbjork](https://github.com/martenbjork)! - Fixed the border radius of `DropZone` - [Shopify#9155](Shopify#9155) [`563af5094`](Shopify@563af50) Thanks [@ryanwilsonperkin](https://github.com/ryanwilsonperkin)! - Fix PortalsManager to avoid setting state synchronously during a render pass which prevented it from working properly with Suspense. - [Shopify#9248](Shopify#9248) [`5548436ca`](Shopify@5548436) Thanks [@chloerice](https://github.com/chloerice)! - Reverted support for `ReactNode` labels on `Select` `options` - [Shopify#9148](Shopify#9148) [`11f4cef4a`](Shopify@11f4cef) Thanks [@samrose3](https://github.com/samrose3)! - Recalculated IndexTable sticky header column widths inside of a `useIsomorphicLayoutEffect` after the table is updated. - [Shopify#9231](Shopify#9231) [`f7f160d0f`](Shopify@f7f160d) Thanks [@skparkk](https://github.com/skparkk)! - Fixed `Tooltip` rendering when `active` prop is false - [Shopify#9095](Shopify#9095) [`9fdc798a5`](Shopify@9fdc798) Thanks [@FCalabria](https://github.com/FCalabria)! - Improved spacing and types on `Select` component - [Shopify#9106](Shopify#9106) [`2f2edd8fc`](Shopify@2f2edd8) Thanks [@samrose3](https://github.com/samrose3)! - Fixed padding on AlphaFilter in IndexFilter when hideQueryField is true - [Shopify#8957](Shopify#8957) [`bb67c17da`](Shopify@bb67c17) Thanks [@bsharrow](https://github.com/bsharrow)! - Fixed `FilterPill` so that it no longer opens an applied filter's popover by default - [Shopify#9154](Shopify#9154) [`66d0adc9a`](Shopify@66d0adc) Thanks [@gui-santos](https://github.com/gui-santos)! - Change default value of Tooltip position to `above` - [Shopify#9206](Shopify#9206) [`76ed72b41`](Shopify@76ed72b) Thanks [@alllx](https://github.com/alllx)! - Fix IndexTable sticky column header overlap - [Shopify#9169](Shopify#9169) [`84189fef1`](Shopify@84189fe) Thanks [@rcaplanshopify](https://github.com/rcaplanshopify)! - [Popover] Updates fullHeight styles to prevent scroll position reset when Popover content changes - [Shopify#9195](Shopify#9195) [`e9bbbb437`](Shopify@e9bbbb4) Thanks [@kyledurand](https://github.com/kyledurand)! - Fixed critical color on progress bar - [Shopify#9160](Shopify#9160) [`fed35736b`](Shopify@fed3573) Thanks [@jbalsas](https://github.com/jbalsas)! - Adjusted colours of disabled `Listbox.TextOption` and `OptionList` components for better readability and a11y - Updated dependencies \[[`5a9b011d1`](Shopify@5a9b011), [`4e343a180`](Shopify@4e343a1), [`5be210bd5`](Shopify@5be210b)]: - @shopify/polaris-tokens@6.14.0 - @shopify/polaris-icons@6.16.0 ## @shopify/polaris-tokens@6.14.0 ### Minor Changes - [Shopify#9144](Shopify#9144) [`5a9b011d1`](Shopify@5a9b011) Thanks [@dGoligorsky](https://github.com/dGoligorsky)! - Updated color-icon-magic to the correct shade of purple[500] ## @shopify/polaris-cli@0.1.37 ### Patch Changes - Updated dependencies \[]: - @shopify/polaris-migrator@0.18.2 ## @shopify/polaris-codemods@0.1.2 ### Patch Changes - Updated dependencies \[[`5a9b011d1`](Shopify@5a9b011), [`6ae3295e7`](Shopify@6ae3295)]: - @shopify/polaris-tokens@6.14.0 - @shopify/stylelint-polaris@12.0.1 ## @shopify/polaris-migrator@0.18.2 ### Patch Changes - Updated dependencies \[[`5a9b011d1`](Shopify@5a9b011), [`6ae3295e7`](Shopify@6ae3295)]: - @shopify/polaris-tokens@6.14.0 - @shopify/stylelint-polaris@12.0.1 ## @shopify/stylelint-polaris@12.0.1 ### Patch Changes - [Shopify#9228](Shopify#9228) [`6ae3295e7`](Shopify@6ae3295) Thanks [@BPScott](https://github.com/BPScott)! - Widen stylelint peerDependency range to include v15 - Updated dependencies \[[`5a9b011d1`](Shopify@5a9b011)]: - @shopify/polaris-tokens@6.14.0 ## polaris.shopify.com@0.53.0 ### Minor Changes - [Shopify#9145](Shopify#9145) [`6ead43c3c`](Shopify@6ead43c) Thanks [@laurkim](https://github.com/laurkim)! - Deprecated `LegacyFilters` - [Shopify#9172](Shopify#9172) [`0534cd2ea`](Shopify@0534cd2) Thanks [@heyjoethomas](https://github.com/heyjoethomas)! - Updated contribution section on doc site to be more concise and clear. - [Shopify#9202](Shopify#9202) [`ffe96a05f`](Shopify@ffe96a0) Thanks [@yurm04](https://github.com/yurm04)! - Added `service` endpoint for analytics calls - [Shopify#9147](Shopify#9147) [`082fe4308`](Shopify@082fe43) Thanks [@laurkim](https://github.com/laurkim)! - Added component pages and examples for `AlphaTabs` and `AlphaFilters` on style guide - [Shopify#9246](Shopify#9246) [`a8c1443cc`](Shopify@a8c1443) Thanks [@yurm04](https://github.com/yurm04)! - Added auth header for service api ### Patch Changes - [Shopify#9191](Shopify#9191) [`c1dd9ec1f`](Shopify@c1dd9ec) Thanks [@gwyneplaine](https://github.com/gwyneplaine)! - Fix component names in layout-and-structure index page to prevent 404s. - [Shopify#9150](Shopify#9150) [`aac73a9ab`](Shopify@aac73a9) Thanks [@aveline](https://github.com/aveline)! - Update `Icons` content on styleguide - [Shopify#9186](Shopify#9186) [`d32c7270e`](Shopify@d32c727) Thanks [@heyjoethomas](https://github.com/heyjoethomas)! - Republish new feature pattern guidance. - [Shopify#9111](Shopify#9111) [`fb102fbc1`](Shopify@fb102fb) Thanks [@laurkim](https://github.com/laurkim)! - Updated `SettingTogle` to show `with primitive components` first in style guide - [Shopify#9179](Shopify#9179) [`41954ff7d`](Shopify@41954ff) Thanks [@gwyneplaine](https://github.com/gwyneplaine)! - Update banner styles and copy on Patterns page - Updated dependencies \[[`048502ceb`](Shopify@048502c), [`5a9b011d1`](Shopify@5a9b011), [`563af5094`](Shopify@563af50), [`5548436ca`](Shopify@5548436), [`4e343a180`](Shopify@4e343a1), [`487df3a4d`](Shopify@487df3a), [`11f4cef4a`](Shopify@11f4cef), [`f7f160d0f`](Shopify@f7f160d), [`9fdc798a5`](Shopify@9fdc798), [`2f2edd8fc`](Shopify@2f2edd8), [`bb67c17da`](Shopify@bb67c17), [`66d0adc9a`](Shopify@66d0adc), [`6ead43c3c`](Shopify@6ead43c), [`92214e8fd`](Shopify@92214e8), [`5be210bd5`](Shopify@5be210b), [`a9d611401`](Shopify@a9d6114), [`76ed72b41`](Shopify@76ed72b), [`84189fef1`](Shopify@84189fe), [`e9bbbb437`](Shopify@e9bbbb4), [`fed35736b`](Shopify@fed3573), [`082fe4308`](Shopify@082fe43), [`b228b67f2`](Shopify@b228b67)]: - @shopify/polaris@10.50.0 - @shopify/polaris-tokens@6.14.0 - @shopify/polaris-icons@6.16.0 Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
### WHY are these changes introduced? There are two different changes here: 1. Set equal spacing to both size of the `prefix` when the select has an inline label. Previously the spacing on the left side was smaller than the spacing on the right, which made the prefix look more related to the select label than to that specific option. Now both sides have equal spacing. Before: ![](https://screenshot.click/26-54-xs84i-um2i0.png) After: ![](https://screenshot.click/26-55-sgbwy-x2v7u.png) 2. Change type for `StrictOption.label` to allow the use of `React.ReactNode` too. This way we can use styled text on it ![](https://screenshot.click/26-56-ly7te-l30l0.png) ### How to 🎩 🖥 [Local development instructions](https://github.com/Shopify/polaris/blob/main/README.md#local-development) 🗒 [General tophatting guidelines](https://github.com/Shopify/polaris/blob/main/documentation/Tophatting.md) 📄 [Changelog guidelines](https://github.com/Shopify/polaris/blob/main/.github/CONTRIBUTING.md#changelog) Spin: https://admin.web.select-changes.paqui-calabria.eu.spin.dev/store/shop1/collections/1 <details> <summary>Copy-paste this code in <code>playground/Playground.tsx</code>:</summary> ```jsx import React, {useCallback, useState} from 'react'; import {EnableSelectionMinor} from '@shopify/polaris-icons'; import {Icon, Page, Select, Text} from '../src'; export function Playground() { const [selected, setSelected] = useState('newestUpdate'); const handleSelectChange = useCallback( (value: string) => setSelected(value), [], ); const options = [ { label: 'Better spacing', value: 'adjustSpacing', prefix: <Icon source={EnableSelectionMinor} />, }, { label: ( <Text as="span" color="success" fontWeight="bold"> Label as react node </Text> ), value: 'reactNodeLabel', }, ]; return ( <Page title="Playground"> <Select label="Sort by" labelInline options={options} onChange={handleSelectChange} value={selected} /> </Page> ); } ``` </details> ### 🎩 checklist - [ ] Tested on [mobile](https://github.com/Shopify/polaris/blob/main/documentation/Tophatting.md#cross-browser-testing) - [ ] Tested on [multiple browsers](https://help.shopify.com/en/manual/shopify-admin/supported-browsers) - [ ] Tested for [accessibility](https://github.com/Shopify/polaris/blob/main/documentation/Accessibility%20testing.md) - [ ] Updated the component's `README.md` with documentation changes - [ ] [Tophatted documentation](https://github.com/Shopify/polaris/blob/main/documentation/Tophatting%20documentation.md) changes in the style guide
Reverts the type change to Select option labels inv Shopify#9095
WHY are these changes introduced?
There are two different changes here:
Set equal spacing to both size of the
prefix
when the select has an inline label.Previously the spacing on the left side was smaller than the spacing on the right, which made the prefix look more related to the select label than to that specific option. Now both sides have equal spacing.
Before:
After:
Change type for
StrictOption.label
to allow the use ofReact.ReactNode
too.This way we can use styled text on it
How to 🎩
🖥 Local development instructions
🗒 General tophatting guidelines
📄 Changelog guidelines
Spin: https://admin.web.select-changes.paqui-calabria.eu.spin.dev/store/shop1/collections/1
Copy-paste this code in
playground/Playground.tsx
:🎩 checklist
README.md
with documentation changes