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

Expose "selected" style in List Item #15121

Open
zdrawku opened this issue Nov 28, 2024 · 0 comments
Open

Expose "selected" style in List Item #15121

zdrawku opened this issue Nov 28, 2024 · 0 comments

Comments

@zdrawku
Copy link
Contributor

zdrawku commented Nov 28, 2024

Is your feature request related to a problem? Please describe.

The lack of a built-in "selected" style for List items complicates the implementation of the common use case for handling a selection state. While other components like Nav Drawer, Dropdown, and Select support a "selected" style out of the box, List items do not.

This forces developers to manually implement selected states and styling in custom code, which can lead to inconsistent design. Additionally, the current "active" state supported by List items is limited as it only reflects a temporary "pressed" state that disappears when the mouse button is released. This behavior does not address the common use case of persisting a selection state style for List items, which is essential for many applications.

Describe the solution you'd like

Introduce support for a "selected" style for List items. This may involve the following:

  • Adding a "selected" style in the theme for List items, similar to the selected styles already available for components like Nav Drawer (active), Dropdown, and Select.

  • Allow developers to bind a "selected" state to List items declaratively. For example what we have in NavDrawer item:
    ...
    <span igxDrawerItem [isHeader]="true">Components
    <span *ngFor="let item of navItems" igxDrawerItem [active]="item.text === selected" igxRipple (click)="navigate(item)">
    ...

Expectation example with the List item:
<igx-list-item [selected]="record.Id === selectedCustomer.Id">

  • Ensure the "selected" styles align with Ignite's overall theming approach to provide a seamless and visually consistent experience.

The implementation should not include built-in selection state management by the List itself, allowing developers full control over the selection logic while benefiting from consistent styling.

Describe alternatives you've considered

Developers can manually add CSS styles and manage the "selected" state in their code. However, this approach is time-consuming, error-prone, and inconsistent with the rest of the framework.

Additional context

Adding a "selected" style for List items would align Ignite UI for Angular with its existing components, such as Nav Drawer, Dropdown, and Select, which already support "selected" styles.

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

No branches or pull requests

1 participant