Skip to content

Conversation

NguyenThuyLan
Copy link
Contributor

Description

Types of changes

  • Breaking change (fix or feature that would cause existing functionality to change)

Motivation and context

The uui-select component receives an array of options. If one of the options has selected: true, then that will be the one selected.
That is not intuative, as a developer usually would set the value in this style:

const CountryOptions = [
  { value: "AD", name: "Andorra" },
  { value: "AE", name: "United Arab Emirates" },
  { value: "AL", name: "Albania" },
  { value: "AM", name: "Armenia" },
];

@property()
selectedCountry = "AM";

<uui-select
          label="Select country"
          placeholder="Select country..."
          value=${this.selectedCountry ?? ""}
          .options=${
            CountryOptions
          }
          @change=${this.#onCountryChanged}
        ></uui-select>

This PR is about making above work.

How to test?

Screenshots (if appropriate)

Checklist

  • If my change requires a change to the documentation, I have updated the documentation in this pull request.
  • I have read the CONTRIBUTING document.
  • I have added tests to cover my changes.

Copy link

github-actions bot commented Jul 3, 2025

Azure Static Web Apps: Your stage site is ready! Visit it here: https://delightful-beach-055ecb503-1141.westeurope.azurestaticapps.net

Copy link

Azure Static Web Apps: Your stage site is ready! Visit it here: https://delightful-beach-055ecb503-1141.westeurope.azurestaticapps.net

Copy link

Copy link

Azure Static Web Apps: Your stage site is ready! Visit it here: https://delightful-beach-055ecb503-1141.westeurope.azurestaticapps.net

Copy link
Contributor

@iOvergaard iOvergaard left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I see your point, @LanThuyNguyen, that this is more intuitive. However, it is a breaking change that we cannot get into a minor release if we remove the previous option. So I was wondering if you think we can get both ways to work, and then also deprecate the old option (selected?: boolean) instead of removing it entirely.

What do you think?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants