react-spectrum icon indicating copy to clipboard operation
react-spectrum copied to clipboard

RFC: Ability to provide selection trigger for Card

Open natvilla opened this issue 1 year ago โ€ข 2 comments

Provide a general summary of the feature here

Currently, the Card component only allows a Checkbox for selection in a CardView. In order to prepare for new designs, allow users to trigger a selection with a custom trigger such as a ToggleButton.

๐Ÿค” Expected Behavior?

Allow user to provide a selection trigger according to their own designs, while ideally maintaining accessibility patterns for the trigger.

๐Ÿ˜ฏ Current Behavior

Currently the CardBase uses a Checkbox component for selection. This option is difficult to override since the Checkbox is used directly in the CardBase component.

๐Ÿ’ Possible Solution

There are a few different routes that can be taken here I think:

  • Separate out the Card from the selection trigger; can possibly use and expose hooks like useCard, useSelectionTrigger
  • Create an additional CardBase component with a ToggleButton at the bottom?
  • Other ideas I'm not thinking of

๐Ÿ”ฆ Context

We currently have designs that use a card grid with a toggle button for selection. In order to implement these designs, we would have to re-invent the wheel in order in order to correctly implement accessibility patterns. Making room for a custom selector would help us move forward and also move this component forward in terms of emerging designs.

๐Ÿ’ป Examples

Here is an example of the design:

Screen Shot 2024-02-20 at 2 46 47 PM

๐Ÿงข Your Company/Team

Adobe / Agora squad

๐Ÿ•ท Tracking Issue

No response

natvilla avatar Feb 20 '24 22:02 natvilla

Just want to double check, have you or your designer spoken to Spectrum Design about this kind of Card? Apologies if so, don't think I've seen the designs for this kind of card if so.

LFDanLu avatar Feb 20 '24 22:02 LFDanLu

@LFDanLu - Yes we have. Our team is going to set up a meeting with your team about this proposal as well so you can have some more context. Meeting to come!

natvilla avatar Feb 20 '24 22:02 natvilla