trimble-oss / modus-web-components

This library provides Modus components as web components - reusable, encapsulated UI elements that are framework agnostic (can be implemented in any site).
https://modus-web-components.trimble.com/
MIT License
34 stars 71 forks source link

Button Group: By default the first button should be selected #2642

Closed anwishaZ closed 2 months ago

anwishaZ commented 3 months ago

Prerequisites

Proposal

This is how the first button should be selected by default on starting the application and then later the select can be changed onclick of other buttons. buttongroup

Motivation and context

When the user opens the application, no button is selected by default. As a result, the user has to manually select a button each time they enter. To enhance the UI, it is better to have a default button selected. This way, the user can still choose to select other buttons if needed, but they won't have to make an initial selection every time they open the application.

What is the issue regarding ?

Modus Web Components Website (Storybook)

Priority

Medium

What product/project are you using Modus Components for ?

TRIMBLE FORESTRY

What is your team/division name ?

Central Product development

Are you willing to contribute ?

No

Are you using Modus Web Components in production ?

Yes

github-actions[bot] commented 3 months ago

Hello @anwishaZ! Thanks for opening an issue. The Modus core team will get back to you soon (usually within 24-hours) and provide guidance on how to proceed. Contributors are welcome to participate in the discussion and provide their input on how to best solve the issue, and even submit a PR if they want to.

Please wait until the issue is ready to be worked on before submitting a PR, or you can reach out to the core team if it is time bound. For trivial things, or bugs that don't change the expected behaviors and UI, you can go ahead and make a PR.

coliff commented 3 months ago

Hi @anwishaZ- the style guide needs to be updated. Button groups aren't just for toggle groups, they can also be used for a group of related buttons but not necessarily toggleable.

I understand that you'd like an option pre-selected for the 'single-selection' option (https://modus-web-components.trimble.com/?path=/docs/components-button-group--default#single-selection). I would suggest that this could be an option (opt-in), but not on by default. maybe something like:

<modus-button-group selection-type="single">
  <modus-button selected>Button 1</modus-button>
  <modus-button>Button 2</modus-button>
  <modus-button>Button 3</modus-button>
</modus-button-group>