Skip to content
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

Add selectedLabelRenderer to enable the ability to customize the selected label #10

Closed
uluk01 opened this issue Nov 28, 2024 · 1 comment · Fixed by #11
Closed

Add selectedLabelRenderer to enable the ability to customize the selected label #10

uluk01 opened this issue Nov 28, 2024 · 1 comment · Fixed by #11
Assignees
Labels
enhancement New feature or request

Comments

@uluk01
Copy link

uluk01 commented Nov 28, 2024

Title: Add Customizable Selected Label in ux-select


Description:
We need to implement a feature that allows customization of the label displayed for the selected option in the ux-select component.

Proposed Solution:
Introduce a new prop selectedLabelRenderer that enables users to define how the label for the selected option should be displayed.

Example 1:
The prop receives a data object representing the selected option:

selectedLabelRenderer: (data) => {
  return `${data.value} | ${data.country} | ${data.label}`;
},

Example 2:
Alternatively, the prop can also pass the option element itself, allowing more flexibility to access its attributes or dataset:

selectedLabelRenderer: (data, option) => {
  return `${option.dataset.country} | ${data.label}`;
},

Use Cases:

  • Display additional information in the selected label, such as country names, custom attributes, or concatenated values.
  • Allow users to tailor the label display to match specific UX/UI requirements.

Expected Outcome:
ux-select should render a label based on the function provided in the selectedLabelRenderer prop, offering complete customization of the selected option's appearance.

@afonja14755 afonja14755 self-assigned this Nov 29, 2024
@afonja14755 afonja14755 added the enhancement New feature or request label Nov 29, 2024
@afonja14755
Copy link
Owner

@uluk01, thank you for your request. I will look into this feature and add it soon.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants